From: Tom Lane Date: Thu, 13 Nov 2014 23:19:35 +0000 (-0500) Subject: Fix pg_dumpall to restore its ability to dump from ancient servers. X-Git-Tag: REL9_2_10~84 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c5ce5102e5bfcf0a56a564215415862a726e979;p=postgresql 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 --- diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index dc0aeb9b13..9d5e323552 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -679,7 +679,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, " @@ -692,7 +692,7 @@ dumpRoles(PGconn *conn) "null as rolcomment " "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, "