pg_dump roles support

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: pg_dump roles support
Date: 2007-12-10 16:02:17
Message-ID: 20071210160217.GP5031@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

Discussing psql options made me recall an annoying problem that we've
run into. There's no way (unless it was added to 8.3 and I missed it,
but I don't think so) to tell pg_dump 'switch to this role before
doing anything else'. That's very frustrating when you use no-inherit
roles for admins. eg:

create role admin with noinherit;
grant postgres to admin;
grant admin to joesysadmin;

pg_dump -U joesysadmin mydb;

Fails because joesysadmin hasn't got rights to everything directly.
It'd be nice if pg_dump could take a '-r postgres' to 'set role' to
a role which has the necessary permissions before locking all the
tables and whatnot. The same 'set role' would also be included at the
top of the resulting dump file. We could have a seperate flag for
that but I don't think it's necessary.

Comments?

I doubt there'd be very much code involved but I'd be willing to write
a patch if people agree with the general idea/approach.

Thanks,

Stephen

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-12-10 16:08:20 Re: Release Note Changes
Previous Message Tom Lane 2007-12-10 15:45:35 Re: Release Note Changes