From 64e6570f002af422f3695e4e95d3b2501bc361f2 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Tue, 1 Dec 2020 13:46:19 +0530 Subject: [PATCH] =?UTF-8?q?Fixed=20an=20issue=20where=20schema=20diff?= =?UTF-8?q?=C2=A0doesn't=20show=20the=20result=20of=20compare=20if=20sourc?= =?UTF-8?q?e=20schema=20has=20tables=20with=20RLS.=20Fixes=20#5998?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en_US/release_notes_4_29.rst | 1 + .../databases/schemas/tables/row_security_policies/__init__.py | 3 ++- .../templates/row_security_policies/sql/10_plus/properties.sql | 2 +- .../row_security_policies/sql/9.5_plus/properties.sql | 2 +- .../templates/row_security_policies/sql/default/properties.sql | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/en_US/release_notes_4_29.rst b/docs/en_US/release_notes_4_29.rst index defacae2d..c0f11370e 100644 --- a/docs/en_US/release_notes_4_29.rst +++ b/docs/en_US/release_notes_4_29.rst @@ -28,3 +28,4 @@ Bug fixes | `Issue #5985 `_ - Fixed an issue where the process watcher dialog throws an error for the database server which is already removed. | `Issue #5991 `_ - Ensure that dirty indicator (*) should not be visible when renaming the tabs. | `Issue #5992 `_ - Fixed an issue where escape character is shown when the server/database name has some special characters. +| `Issue #5998 `_ - Fixed an issue where schema diff doesn't show the result of compare if source schema has tables with RLS. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/__init__.py index 29d47bc17..9209321eb 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/row_security_policies/__init__.py @@ -632,7 +632,8 @@ class RowSecurityView(PGChildNodeView): sql = row_security_policies_utils.get_reverse_engineered_sql( self.conn, schema=schema, table=self.table, scid=scid, - plid=oid, datlastsysoid=self.datlastsysoid, with_header=False) + plid=oid, policy_table_id=tid, + datlastsysoid=self.datlastsysoid, with_header=False) drop_sql = '' if drop_req: diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/10_plus/properties.sql index 6d50c3234..2674c9fdc 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/10_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/10_plus/properties.sql @@ -16,7 +16,7 @@ JOIN pg_namespace n ON n.nspname=rw.schemaname JOIN pg_class rel on rel.relname=rw.tablename WHERE {% if plid %} - pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.relfilenode = {{ policy_table_id }}; + pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.oid = {{ policy_table_id }}; {% endif %} {% if tid %} pl.polrelid = {{ tid }}; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/9.5_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/9.5_plus/properties.sql index dcaa60cb9..fde4eeda2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/9.5_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/9.5_plus/properties.sql @@ -15,7 +15,7 @@ JOIN pg_namespace n ON n.nspname=rw.schemaname JOIN pg_class rel on rel.relname=rw.tablename WHERE {% if plid %} - pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.relfilenode = {{ policy_table_id }}; + pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.oid = {{ policy_table_id }}; {% endif %} {% if tid %} pl.polrelid = {{ tid }}; diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/default/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/default/properties.sql index dcaa60cb9..fde4eeda2 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/default/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/row_security_policies/sql/default/properties.sql @@ -15,7 +15,7 @@ JOIN pg_namespace n ON n.nspname=rw.schemaname JOIN pg_class rel on rel.relname=rw.tablename WHERE {% if plid %} - pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.relfilenode = {{ policy_table_id }}; + pl.oid = {{ plid }} and n.oid = {{ scid }} and rel.oid = {{ policy_table_id }}; {% endif %} {% if tid %} pl.polrelid = {{ tid }};