]> granicus.if.org Git - postgresql/commitdiff
Correct query in pg_dumpall:dumpRoles
authorStephen Frost <sfrost@snowman.net>
Fri, 6 May 2016 20:15:52 +0000 (16:15 -0400)
committerStephen Frost <sfrost@snowman.net>
Fri, 6 May 2016 20:15:52 +0000 (16:15 -0400)
We need to use a new branch due to the 9.5 addition of bypassrls
when adding in the clause to exclude pg_* roles from being dumped
by pg_dumpall.

Pointed out by Noah, patch by me.

src/bin/pg_dump/pg_dumpall.c

index 02fa699056270b76cf479e0de72eb41991831b6f..694bd1eeaf4fa8c59c3e9b04d3d1d56eed85d3ff 100644 (file)
@@ -676,6 +676,16 @@ dumpRoles(PGconn *conn)
                                                  "FROM pg_authid "
                                                  "WHERE rolname !~ '^pg_' "
                                                  "ORDER BY 2");
+       else if (server_version >= 90500)
+               printfPQExpBuffer(buf,
+                                                 "SELECT oid, rolname, rolsuper, rolinherit, "
+                                                 "rolcreaterole, rolcreatedb, "
+                                                 "rolcanlogin, rolconnlimit, rolpassword, "
+                                                 "rolvaliduntil, rolreplication, rolbypassrls, "
+                        "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, "
+                                                 "rolname = current_user AS is_current_user "
+                                                 "FROM pg_authid "
+                                                 "ORDER BY 2");
        else if (server_version >= 90100)
                printfPQExpBuffer(buf,
                                                  "SELECT oid, rolname, rolsuper, rolinherit, "