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

Commit7e65ad1

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 parent485f0aa commit7e65ad1

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
@@ -769,39 +769,42 @@ dumpRoles(PGconn *conn)
769769
i_is_current_user;
770770
inti;
771771

772-
/* note: rolconfig is dumped later */
772+
/*
773+
* Notes: rolconfig is dumped later, and pg_authid must be used for
774+
* extracting rolcomment regardless of role_catalog.
775+
*/
773776
if (server_version >=90600)
774777
printfPQExpBuffer(buf,
775778
"SELECT oid, rolname, rolsuper, rolinherit, "
776779
"rolcreaterole, rolcreatedb, "
777780
"rolcanlogin, rolconnlimit, rolpassword, "
778781
"rolvaliduntil, rolreplication, rolbypassrls, "
779-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
782+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
780783
"rolname = current_user AS is_current_user "
781784
"FROM %s "
782785
"WHERE rolname !~ '^pg_' "
783-
"ORDER BY 2",role_catalog,role_catalog);
786+
"ORDER BY 2",role_catalog);
784787
elseif (server_version >=90500)
785788
printfPQExpBuffer(buf,
786789
"SELECT oid, rolname, rolsuper, rolinherit, "
787790
"rolcreaterole, rolcreatedb, "
788791
"rolcanlogin, rolconnlimit, rolpassword, "
789792
"rolvaliduntil, rolreplication, rolbypassrls, "
790-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
793+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
791794
"rolname = current_user AS is_current_user "
792795
"FROM %s "
793-
"ORDER BY 2",role_catalog,role_catalog);
796+
"ORDER BY 2",role_catalog);
794797
else
795798
printfPQExpBuffer(buf,
796799
"SELECT oid, rolname, rolsuper, rolinherit, "
797800
"rolcreaterole, rolcreatedb, "
798801
"rolcanlogin, rolconnlimit, rolpassword, "
799802
"rolvaliduntil, rolreplication, "
800803
"false as rolbypassrls, "
801-
"pg_catalog.shobj_description(oid, '%s') as rolcomment, "
804+
"pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
802805
"rolname = current_user AS is_current_user "
803806
"FROM %s "
804-
"ORDER BY 2",role_catalog,role_catalog);
807+
"ORDER BY 2",role_catalog);
805808

806809
res=executeQuery(conn,buf->data);
807810

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp