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

Commit12128be

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 parentea299d7 commit12128be

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -736,39 +736,42 @@ dumpRoles(PGconn *conn)
736736
i_is_current_user;
737737
inti;
738738

739-
/* note: rolconfig is dumped later */
739+
/*
740+
* Notes: rolconfig is dumped later, and pg_authid must be used for
741+
* extracting rolcomment regardless of role_catalog.
742+
*/
740743
if (server_version >=90600)
741744
printfPQExpBuffer(buf,
742745
"SELECT oid, rolname, rolsuper, rolinherit, "
743746
"rolcreaterole, rolcreatedb, "
744747
"rolcanlogin, rolconnlimit, rolpassword, "
745748
"rolvaliduntil, rolreplication, rolbypassrls, "
746-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
749+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
747750
"rolname = current_user AS is_current_user "
748751
"FROM %s "
749752
"WHERE rolname !~ '^pg_' "
750-
"ORDER BY 2",role_catalog,role_catalog);
753+
"ORDER BY 2",role_catalog);
751754
elseif (server_version >=90500)
752755
printfPQExpBuffer(buf,
753756
"SELECT oid, rolname, rolsuper, rolinherit, "
754757
"rolcreaterole, rolcreatedb, "
755758
"rolcanlogin, rolconnlimit, rolpassword, "
756759
"rolvaliduntil, rolreplication, rolbypassrls, "
757-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
760+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
758761
"rolname = current_user AS is_current_user "
759762
"FROM %s "
760-
"ORDER BY 2",role_catalog,role_catalog);
763+
"ORDER BY 2",role_catalog);
761764
else
762765
printfPQExpBuffer(buf,
763766
"SELECT oid, rolname, rolsuper, rolinherit, "
764767
"rolcreaterole, rolcreatedb, "
765768
"rolcanlogin, rolconnlimit, rolpassword, "
766769
"rolvaliduntil, rolreplication, "
767770
"false as rolbypassrls, "
768-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
771+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
769772
"rolname = current_user AS is_current_user "
770773
"FROM %s "
771-
"ORDER BY 2",role_catalog,role_catalog);
774+
"ORDER BY 2",role_catalog);
772775

773776
res=executeQuery(conn,buf->data);
774777

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp