diff --git a/docs/en_US/release_notes_4_30.rst b/docs/en_US/release_notes_4_30.rst index d6e88feb9..0351a6296 100644 --- a/docs/en_US/release_notes_4_30.rst +++ b/docs/en_US/release_notes_4_30.rst @@ -25,5 +25,6 @@ Bug fixes | `Issue #6046 `_ - Fixed an issue where the state of the Save File icon does not match the dirty editor indicator. | `Issue #6047 `_ - Fixed an issue where the dirty indicator stays active even if all changes were undone. | `Issue #6058 `_ - Ensure that the rename panel should be disabled when the SQL file opened in the query tool. +| `Issue #6061 `_ - Fixed extra parentheses issue around joins for Views. | `Issue #6065 `_ - Fixed accessibility issues in schema diff module. | `Issue #6084 `_ - Fixed TypeError exception in schema diff when selected any identical object. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/properties.sql index b2d6e4605..39b435cb8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.3_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/properties.sql index b2d6e4605..39b435cb8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/mviews/pg/9.4_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.1_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.1_plus/sql/properties.sql index e28d847e7..005af504e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.1_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.1_plus/sql/properties.sql @@ -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 %} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.2_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.2_plus/sql/properties.sql index 3b443f946..82be52cbe 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.2_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.2_plus/sql/properties.sql @@ -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================#} diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.3_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.3_plus/sql/properties.sql index 8af43c86e..45f9a769d 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.3_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.3_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/properties.sql index cd44282f3..aa749ff35 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/templates/views/pg/9.4_plus/sql/properties.sql @@ -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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/test_views_get.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/test_views_get.py index d8491a738..830a40135 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/test_views_get.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/test_views_get.py @@ -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"], diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/view_test_data.json b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/view_test_data.json index 11038c418..413c284dc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/view_test_data.json +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/tests/view_test_data.json @@ -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