Hi, There's a segfault when trying to dump global object from a running 7.4.27 with a pg_dumpall of version 9.3.5 but also 9.2.9.
$ pg_dumpall -g -h localhost -p 5474 column number -1 is out of range 0..12 Segmentation fault (core dumped) The problem comes from the first columns of the query in function dumpRoles(PGconn *conn) that has no alias name. Fixing it with SELECT 0 **as oid**, ...; Fix the issue. This bug affect all versions of PostgreSQL from master down to 9.1, I mean 9.1 is working. In the same query there is an other bug introduced by commit 491c029 that add Row-Level Security Policies. Current master code has a broken pg_dumpall when trying to dump from a backend lower than 8.1. Here is the error: ERROR: each UNION query must have the same number of columns The query sent to the database is the following: SELECT 0, usename as rolname, usesuper as rolsuper, true as rolinherit, usesuper as rolcreaterole, usecreatedb as rolcreatedb, true as rolcanlogin, -1 as rolconnlimit, passwd as rolpassword, valuntil as rolvaliduntil, false as rolreplication, null as rolcomment, usename = current_user AS is_current_user FROM pg_shadow UNION ALL SELECT 0, groname as rolname, false as rolsuper, true as rolinherit, false as rolcreaterole, false as rolcreatedb, false as rolcanlogin, -1 as rolconnlimit, null::text as rolpassword, null::abstime as rolvaliduntil, false as rolreplication, false as rolbypassrls, null as rolcomment, false FROM pg_group WHERE NOT EXISTS (SELECT 1 FROM pg_shadow WHERE usename = groname) ORDER BY 2; The column rolbypassrls is missing in the first UNION query. As this is the same query as previous issue the first column of the query need the same alias: oid. I've attached a patch against master that fix the two issues but for older branch, only alias to the first column of the query might be applied. Let me know if it need other work. Best regards, -- Gilles Darold http://dalibo.com - http://dalibo.org
diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 23cb0b4..b07b1f6 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -714,7 +714,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, " @@ -724,6 +724,7 @@ dumpRoles(PGconn *conn) "passwd as rolpassword, " "valuntil as rolvaliduntil, " "false as rolreplication, " + "false as rolbypassrls, " "null as rolcomment, " "usename = current_user AS is_current_user " "FROM pg_shadow "
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers