From 518b13c77981125fe03be28b4d08694400efee8b Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Fri, 7 Aug 2020 16:30:03 +0530 Subject: [PATCH] Added the 'ORDER BY' clause for the privileges type to fix schema diff issue. Fixes #5689 --- docs/en_US/release_notes_4_25.rst | 1 + .../templates/foreign_tables/sql/9.2_plus/acl.sql | 2 +- .../functions/templates/functions/pg/sql/default/acl.sql | 2 +- .../functions/templates/functions/ppas/sql/default/acl.sql | 2 +- .../functions/templates/procedures/pg/sql/11_plus/acl.sql | 2 +- .../functions/templates/procedures/ppas/sql/default/acl.sql | 2 +- .../templates/trigger_functions/pg/sql/default/acl.sql | 2 +- .../templates/trigger_functions/ppas/sql/default/acl.sql | 2 +- .../schemas/packages/templates/packages/ppas/9.1_plus/acl.sql | 2 +- .../schemas/packages/templates/packages/ppas/9.2_plus/acl.sql | 2 +- .../schemas/tables/templates/tables/sql/10_plus/acl.sql | 2 +- .../schemas/tables/templates/tables/sql/9.1_plus/acl.sql | 2 +- .../databases/schemas/types/templates/types/sql/default/acl.sql | 2 +- 13 files changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/en_US/release_notes_4_25.rst b/docs/en_US/release_notes_4_25.rst index 585bc023f..8dd152417 100644 --- a/docs/en_US/release_notes_4_25.rst +++ b/docs/en_US/release_notes_4_25.rst @@ -31,6 +31,7 @@ Bug fixes | `Issue #5490 `_ - Make the runtime configuration dialog non-modal. | `Issue #5632 `_ - Ensure that the user will be able to modify the start value of the Identity column. | `Issue #5646 `_ - Ensure that RLS Policy node should be searchable using search object. +| `Issue #5689 `_ - Added the 'ORDER BY' clause for the privileges type to fix schema diff issue. | `Issue #5708 `_ - Correct TLS certificate filename in the container deployment docs. | `Issue #5710 `_ - Fixed an issue when comparing the table with a trigger throwing error in schema diff. | `Issue #5716 `_ - Fixed an issue where ajax call continues to fire even after disconnect the database server. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/acl.sql index 2322a4c4b..154ff8a22 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/foreign_tables/templates/foreign_tables/sql/9.2_plus/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.relacl) AS d FROM pg_class db - WHERE db.oid = {{foid}}::OID) a + WHERE db.oid = {{foid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/default/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/ppas/sql/default/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/pg/sql/11_plus/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/procedures/ppas/sql/default/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/pg/sql/default/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/ppas/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/ppas/sql/default/acl.sql index 2e7aae544..ebbbe7d56 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/ppas/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/trigger_functions/ppas/sql/default/acl.sql @@ -27,7 +27,7 @@ FROM (d).privilege_type AS privilege_type FROM (SELECT aclexplode(db.proacl) AS d FROM pg_proc db - WHERE db.oid = {{fnid}}::OID) a + WHERE db.oid = {{fnid}}::OID) a ORDER BY privilege_type ) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.1_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.1_plus/acl.sql index af1870cbe..40a5fd03a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.1_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.1_plus/acl.sql @@ -26,7 +26,7 @@ FROM (SELECT (d).grantee AS grantee, (d).grantor AS grantor, (d).is_grantable AS is_grantable, (d).privilege_type AS privilege_type FROM (SELECT aclexplode(nspacl) as d FROM pg_namespace WHERE nspparent = {{scid}}::oid - AND oid = {{pkgid}}::oid) a) d + AND oid = {{pkgid}}::oid) a ORDER BY privilege_type) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.2_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.2_plus/acl.sql index 9fbcba2de..7bbf16a96 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.2_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/packages/templates/packages/ppas/9.2_plus/acl.sql @@ -28,7 +28,7 @@ FROM AS is_grantable, (d).privilege_type AS privilege_type FROM (SELECT aclexplode(nspacl) as d FROM pg_namespace WHERE nspparent = {{scid}}::oid AND oid = {{pkgid}}::oid - AND nspobjecttype = 0) a) d + AND nspobjecttype = 0) a ORDER BY privilege_type) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/acl.sql index eadf9d58a..abdff820b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/10_plus/acl.sql @@ -39,7 +39,7 @@ FROM LEFT JOIN pg_type typ ON rel.reloftype=typ.oid WHERE rel.relkind IN ('r','s','t','p') AND rel.relnamespace = {{ scid }}::oid AND rel.oid = {{ tid }}::oid - ) a) d + ) a ORDER BY privilege_type) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.1_plus/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.1_plus/acl.sql index 8d7fc6db1..e48e44d91 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.1_plus/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/tables/sql/9.1_plus/acl.sql @@ -39,7 +39,7 @@ FROM LEFT JOIN pg_type typ ON rel.reloftype=typ.oid WHERE rel.relkind IN ('r','s','t') AND rel.relnamespace = {{ scid }}::oid AND rel.oid = {{ tid }}::oid - ) a) d + ) a ORDER BY privilege_type) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid) diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/sql/default/acl.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/sql/default/acl.sql index 83c1605a1..76d0aeb7a 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/sql/default/acl.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/templates/types/sql/default/acl.sql @@ -19,7 +19,7 @@ FROM ) acl, (SELECT (d).grantee AS grantee, (d).grantor AS grantor, (d).is_grantable AS is_grantable, (d).privilege_type AS privilege_type FROM (SELECT - aclexplode(t.typacl) as d FROM pg_type t WHERE t.oid = {{tid}}::oid) a) d + aclexplode(t.typacl) as d FROM pg_type t WHERE t.oid = {{tid}}::oid) a ORDER BY privilege_type) d ) d LEFT JOIN pg_catalog.pg_roles g ON (d.grantor = g.oid) LEFT JOIN pg_catalog.pg_roles gt ON (d.grantee = gt.oid)