Fixed extra parentheses issue around joins for Views. Fixes #6061

This commit is contained in:
Nikhil Mohite 2020-12-23 13:02:16 +05:30 committed by Akshay Joshi
parent c933771016
commit a92595012f
9 changed files with 17 additions and 10 deletions

View File

@ -25,5 +25,6 @@ Bug fixes
| `Issue #6046 <https://redmine.postgresql.org/issues/6046>`_ - Fixed an issue where the state of the Save File icon does not match the dirty editor indicator.
| `Issue #6047 <https://redmine.postgresql.org/issues/6047>`_ - Fixed an issue where the dirty indicator stays active even if all changes were undone.
| `Issue #6058 <https://redmine.postgresql.org/issues/6058>`_ - Ensure that the rename panel should be disabled when the SQL file opened in the query tool.
| `Issue #6061 <https://redmine.postgresql.org/issues/6061>`_ - Fixed extra parentheses issue around joins for Views.
| `Issue #6065 <https://redmine.postgresql.org/issues/6065>`_ - Fixed accessibility issues in schema diff module.
| `Issue #6084 <https://redmine.postgresql.org/issues/6084>`_ - Fixed TypeError exception in schema diff when selected any identical object.

View File

@ -15,7 +15,7 @@ SELECT
nsp.nspname as schema,
pg_get_userbyid(c.relowner) AS owner,
description AS comment,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
{# ============= Checks if it is system view ================ #}
{% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,

View File

@ -15,7 +15,7 @@ SELECT
nsp.nspname as schema,
pg_get_userbyid(c.relowner) AS owner,
description AS comment,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
{# ============= Checks if it is system view ================ #}
{% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,

View File

@ -8,7 +8,7 @@ SELECT
description AS comment,
c.reltablespace AS spcoid,
pg_get_userbyid(c.relowner) AS owner,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
array_to_string(c.relacl::text[], ', ') AS acl,
{#=============Checks if it is system view================#}
{% if vid and datlastsysoid %}

View File

@ -8,7 +8,7 @@ SELECT
(CASE WHEN length(spc.spcname::text) > 0 THEN spc.spcname ELSE 'pg_default' END) as spcname,
pg_get_userbyid(c.relowner) AS owner,
description As comment,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
nsp.nspname AS schema,
array_to_string(c.relacl::text[], ', ') AS acl,
{#=============Checks if it is system view================#}

View File

@ -11,7 +11,7 @@ SELECT
c.relispopulated AS ispopulated,
pg_get_userbyid(c.relowner) AS owner,
array_to_string(c.relacl::text[], ', ') AS acl,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
{# ===== Checks if it is system view ===== #}
{% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,

View File

@ -12,7 +12,7 @@ SELECT
c.relispopulated AS ispopulated,
pg_get_userbyid(c.relowner) AS owner,
array_to_string(c.relacl::text[], ', ') AS acl,
pg_get_viewdef(c.oid) AS definition,
pg_get_viewdef(c.oid, true) AS definition,
{# ===== Checks if it is system view ===== #}
{% if vid and datlastsysoid %}
CASE WHEN {{vid}} <= {{datlastsysoid}} THEN True ELSE False END AS system_view,

View File

@ -85,8 +85,12 @@ class ViewsGetTestCase(BaseTestGenerator):
test_result_data = self.expected_data["test_result_data"]
if bool(test_result_data):
response_data = json.loads(response.data.decode('utf-8'))
self.assertIn(test_result_data["definition"],
response_data['definition'])
if self.server['type'] == 'pg':
self.assertIn(test_result_data["pg_definition"],
response_data['definition'])
else:
self.assertIn(test_result_data["definition"],
response_data['definition'])
else:
if self.mocking_required:
with patch(self.mock_data["function_name"],

View File

@ -164,7 +164,8 @@
"status_code": 200,
"error_msg": null,
"test_result_data": {
"definition": " SELECT\n CASE\n WHEN ((pg_db.datistemplate = false) AND (pg_db.datallowconn = true) AND ((pg_db.datconnlimit = '-1'::integer) OR (pg_db.datacl IS NULL))) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;"
"definition": " SELECT\n CASE\n WHEN ((pg_db.datistemplate = false) AND (pg_db.datallowconn = true) AND ((pg_db.datconnlimit = '-1'::integer) OR (pg_db.datacl IS NULL))) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;",
"pg_definition": " SELECT\n CASE\n WHEN pg_db.datistemplate = false AND pg_db.datallowconn = true AND (pg_db.datconnlimit = '-1'::integer OR pg_db.datacl IS NULL) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;"
}
},
"is_list": false
@ -463,7 +464,8 @@
"status_code": 200,
"error_msg": null,
"test_result_data": {
"definition": " SELECT\n CASE\n WHEN ((pg_db.datistemplate = false) AND (pg_db.datallowconn = true) AND ((pg_db.datconnlimit = '-1'::integer) OR (pg_db.datacl IS NULL))) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;"
"definition": " SELECT\n CASE\n WHEN ((pg_db.datistemplate = false) AND (pg_db.datallowconn = true) AND ((pg_db.datconnlimit = '-1'::integer) OR (pg_db.datacl IS NULL))) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;",
"pg_definition": " SELECT\n CASE\n WHEN pg_db.datistemplate = false AND pg_db.datallowconn = true AND (pg_db.datconnlimit = '-1'::integer OR pg_db.datacl IS NULL) THEN true\n ELSE false\n END AS res\n FROM pg_database pg_db;"
}
},
"is_list": false