aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-11-13 18:19:28 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-11-13 18:19:28 -0500
commit2c267e47afa4f9a7cc8f04f43e440dfdf9fd3ed7 (patch)
tree6c80d77d904c98eae27712f3ef869f02835b4954
parent11868e1704cae36ee13303eaf9f5f5f656870426 (diff)
downloadpostgresql-2c267e47afa4f9a7cc8f04f43e440dfdf9fd3ed7.tar.gz
postgresql-2c267e47afa4f9a7cc8f04f43e440dfdf9fd3ed7.zip
Fix pg_dumpall to restore its ability to dump from ancient servers.
Fix breakage induced by commits d8d3d2a4f37f6df5d0118b7f5211978cca22091a and 463f2625a5fb183b6a8925ccde98bb3889f921d9: pg_dumpall has crashed when attempting to dump from pre-8.1 servers since then, due to faulty construction of the query used for dumping roles from older servers. The query was erroneous as of the earlier commit, but it wasn't exposed unless you tried to use --binary-upgrade, which you presumably wouldn't with a pre-8.1 server. However commit 463f2625a made it fail always. In HEAD, also fix additional breakage induced in the same query by commit 491c029dbc4206779cf659aa0ff986af7831d2ff, which evidently wasn't tested against pre-8.1 servers either. The bug is only latent in 9.1 because 463f2625a hadn't landed yet, but it seems best to back-patch all branches containing the faulty query. Gilles Darold
-rw-r--r--src/bin/pg_dump/pg_dumpall.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c
index 699a1af7b8f..0f1de59fd0c 100644
--- a/src/bin/pg_dump/pg_dumpall.c
+++ b/src/bin/pg_dump/pg_dumpall.c
@@ -700,7 +700,7 @@ dumpRoles(PGconn *conn)
"ORDER BY 2");
else
printfPQExpBuffer(buf,
- "SELECT 0, usename as rolname, "
+ "SELECT 0 as oid, usename as rolname, "
"usesuper as rolsuper, "
"true as rolinherit, "
"usesuper as rolcreaterole, "
@@ -714,7 +714,7 @@ dumpRoles(PGconn *conn)
"usename = current_user AS is_current_user "
"FROM pg_shadow "
"UNION ALL "
- "SELECT 0, groname as rolname, "
+ "SELECT 0 as oid, groname as rolname, "
"false as rolsuper, "
"true as rolinherit, "
"false as rolcreaterole, "
@@ -724,7 +724,8 @@ dumpRoles(PGconn *conn)
"null::text as rolpassword, "
"null::abstime as rolvaliduntil, "
"false as rolreplication, "
- "null as rolcomment, false "
+ "null as rolcomment, "
+ "false AS is_current_user "
"FROM pg_group "
"WHERE NOT EXISTS (SELECT 1 FROM pg_shadow "
" WHERE usename = groname) "