From: | Gilles Darold <gilles(dot)darold(at)dalibo(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Segmentation fault in pg_dumpall from master down to 9.1 and other bug introduced by RLS |
Date: | 2014-11-13 16:20:22 |
Message-ID: | 5464DA46.3000209@dalibo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
Attachment | Content-Type | Size |
---|---|---|
pg_dumpall_segfault_on_oldversion.diff | text/x-patch | 773 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-11-13 16:41:18 | Re: REINDEX CONCURRENTLY 2.0 |
Previous Message | Andres Freund | 2014-11-13 16:14:47 | Re: controlling psql's use of the pager a bit more |