From: | Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_dump broken for non-super user |
Date: | 2016-05-03 11:04:49 |
Message-ID: | CAGPqQf3Uzo-yU1suYyoZR83h6QTxXxkGTtEyeMV7EAVBqn=PcQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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(at)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 | Content-Type | Size |
---|---|---|
pg_dump_fix.patch | application/x-download | 605 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | hari.prasath | 2016-05-03 12:51:36 | full table delete query |
Previous Message | Dave Page | 2016-05-03 09:05:10 | Re: Windows 7, Visual Studio 2010: building PgAdmin3 |