Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7652142

Browse files
committed
Sort DO_DEFAULT_ACL dump objects independent of OIDs.
Commit0decd5e missed DO_DEFAULT_ACL,leading to assertion failures, potential dump order instability, andspurious schema diffs. Back-patch to v13, like that commit.Reported-by: Alexander Lakhin <exclusion@gmail.com>Author: Kirill Reshke <reshkekirill@gmail.com>Discussion:https://postgr.es/m/d32aaa8d-df7c-4f94-bcb3-4c85f02bea21@gmail.comBackpatch-through: 13
1 parent2ce6abd commit7652142

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

‎src/bin/pg_dump/pg_dump_sort.c‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,19 @@ DOTypeNameCompare(const void *p1, const void *p2)
418418
returncmpval;
419419
}
420420
}
421+
elseif (obj1->objType==DO_DEFAULT_ACL)
422+
{
423+
DefaultACLInfo*daclobj1=*(DefaultACLInfo*const*)p1;
424+
DefaultACLInfo*daclobj2=*(DefaultACLInfo*const*)p2;
425+
426+
/*
427+
* Sort by defaclrole, per pg_default_acl_role_nsp_obj_index. The
428+
* (namespace, name) match (defaclnamespace, defaclobjtype).
429+
*/
430+
cmpval=strcmp(daclobj1->defaclrole,daclobj2->defaclrole);
431+
if (cmpval!=0)
432+
returncmpval;
433+
}
421434
elseif (obj1->objType==DO_PUBLICATION_REL)
422435
{
423436
PublicationRelInfo*probj1=*(PublicationRelInfo*const*)p1;

‎src/test/regress/expected/privileges.out‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,11 @@ DROP USER regress_priv_user6;
31533153
DROP USER regress_priv_user7;
31543154
DROP USER regress_priv_user8; -- does not exist
31553155
ERROR: role "regress_priv_user8" does not exist
3156+
-- leave some default ACLs for pg_upgrade's dump-restore test input.
3157+
ALTER DEFAULT PRIVILEGES FOR ROLE pg_signal_backend
3158+
REVOKE INSERT ON TABLES FROM pg_signal_backend;
3159+
ALTER DEFAULT PRIVILEGES FOR ROLE pg_read_all_settings
3160+
REVOKE INSERT ON TABLES FROM pg_read_all_settings;
31563161
-- permissions with LOCK TABLE
31573162
CREATE USER regress_locktable_user;
31583163
CREATE TABLE lock_table (a int);

‎src/test/regress/sql/privileges.sql‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,6 +1863,13 @@ DROP USER regress_priv_user7;
18631863
DROPUSER regress_priv_user8;-- does not exist
18641864

18651865

1866+
-- leave some default ACLs for pg_upgrade's dump-restore test input.
1867+
ALTER DEFAULT PRIVILEGES FOR ROLE pg_signal_backend
1868+
REVOKE INSERTON TABLESFROM pg_signal_backend;
1869+
ALTER DEFAULT PRIVILEGES FOR ROLE pg_read_all_settings
1870+
REVOKE INSERTON TABLESFROM pg_read_all_settings;
1871+
1872+
18661873
-- permissions with LOCK TABLE
18671874
CREATEUSERregress_locktable_user;
18681875
CREATETABLElock_table (aint);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp