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

Commitbe01c8c

Browse files
Fix dumping role comments when using --no-role-passwords
Commit9a83d56 added support for allowing pg_dumpall to dumproles without including passwords, which accidentally made dumpsomit COMMENTs on roles. This fixes it by using pg_authid to getthe comment.Backpatch to all supported versions. Patch simultaneously writtenindependently by Álvaro and myself.Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Author: Daniel Gustafsson <daniel@yesql.se>Reported-by: Bartosz Chroł <bartosz.chrol@handen.pl>Discussion:https://postgr.es/m/AS8P194MB1271CDA0ADCA7B75FCD8E767F7332@AS8P194MB1271.EURP194.PROD.OUTLOOK.COMDiscussion:https://postgr.es/m/CAEP4nAz9V4H41_4ESJd1Gf0v%3DdevkqO1%3Dpo91jUw-GJSx8Hxqg%40mail.gmail.comBackpatch-through: v12
1 parent33bfbef commitbe01c8c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -760,50 +760,53 @@ dumpRoles(PGconn *conn)
760760
i_is_current_user;
761761
inti;
762762

763-
/* note: rolconfig is dumped later */
763+
/*
764+
* Notes: rolconfig is dumped later, and pg_authid must be used for
765+
* extracting rolcomment regardless of role_catalog.
766+
*/
764767
if (server_version >=90600)
765768
printfPQExpBuffer(buf,
766769
"SELECT oid, rolname, rolsuper, rolinherit, "
767770
"rolcreaterole, rolcreatedb, "
768771
"rolcanlogin, rolconnlimit, rolpassword, "
769772
"rolvaliduntil, rolreplication, rolbypassrls, "
770-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
773+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
771774
"rolname = current_user AS is_current_user "
772775
"FROM %s "
773776
"WHERE rolname !~ '^pg_' "
774-
"ORDER BY 2",role_catalog,role_catalog);
777+
"ORDER BY 2",role_catalog);
775778
elseif (server_version >=90500)
776779
printfPQExpBuffer(buf,
777780
"SELECT oid, rolname, rolsuper, rolinherit, "
778781
"rolcreaterole, rolcreatedb, "
779782
"rolcanlogin, rolconnlimit, rolpassword, "
780783
"rolvaliduntil, rolreplication, rolbypassrls, "
781-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
784+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
782785
"rolname = current_user AS is_current_user "
783786
"FROM %s "
784-
"ORDER BY 2",role_catalog,role_catalog);
787+
"ORDER BY 2",role_catalog);
785788
elseif (server_version >=90100)
786789
printfPQExpBuffer(buf,
787790
"SELECT oid, rolname, rolsuper, rolinherit, "
788791
"rolcreaterole, rolcreatedb, "
789792
"rolcanlogin, rolconnlimit, rolpassword, "
790793
"rolvaliduntil, rolreplication, "
791794
"false as rolbypassrls, "
792-
"pg_catalog.shobj_description(oid,'%s') as rolcomment, "
795+
"pg_catalog.shobj_description(oid,pg_authid') as rolcomment, "
793796
"rolname = current_user AS is_current_user "
794797
"FROM %s "
795-
"ORDER BY 2",role_catalog,role_catalog);
798+
"ORDER BY 2",role_catalog);
796799
elseif (server_version >=80200)
797800
printfPQExpBuffer(buf,
798801
"SELECT oid, rolname, rolsuper, rolinherit, "
799802
"rolcreaterole, rolcreatedb, "
800803
"rolcanlogin, rolconnlimit, rolpassword, "
801804
"rolvaliduntil, false as rolreplication, "
802805
"false as rolbypassrls, "
803-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
806+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
804807
"rolname = current_user AS is_current_user "
805808
"FROM %s "
806-
"ORDER BY 2",role_catalog,role_catalog);
809+
"ORDER BY 2",role_catalog);
807810
elseif (server_version >=80100)
808811
printfPQExpBuffer(buf,
809812
"SELECT oid, rolname, rolsuper, rolinherit, "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp