With commit a9f0e8e5a2e779a888988cb64479a6723f668c84, now pg_dump, use a
bitmap
to represent what to include. With this commit if non-super user is unable
to perform the dump.

Consider the below testcase:

postgres=# select version();

version
-------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6devel on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7
20120313 (Red Hat 4.4.7-16), 64-bit
(1 row)

postgres=#
postgres=# create user u1;
CREATE ROLE
postgres=# \c postgres u1
You are now connected to database "postgres" as user "u1".
postgres=> create table t (a int );
CREATE TABLE
postgres=> \q
rushabh@rushabh-centos-vm:postgresql$ ./db/bin/pg_dump postgres -U u1
pg_dump: [archiver (db)] query failed: ERROR:  permission denied for
relation pg_authid
pg_dump: [archiver (db)] query was: LOCK TABLE pg_catalog.pg_authid IN
ACCESS SHARE MODE


getTables() take read-lock target tables to make sure they aren't DROPPED
or altered in schema before we get around to dumping them. Here it having
below condition to take  a lock:

        if (tblinfo[i].dobj.dump && tblinfo[i].relkind == RELKIND_RELATION)

which need to replace with:

        if ((tblinfo[i].dobj.dump & DUMP_COMPONENT_DEFINITION) &&
            tblinfo[i].relkind == RELKIND_RELATION)

PFA patch to fix the issue.

Thanks,


-- 
Rushabh Lathia
www.EnterpriseDB.com

Attachment: pg_dump_fix.patch
Description: application/download

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to