Re: pg_dump roles support - Mailing list pgsql-hackers

From Stephen Frost
Subject Re: pg_dump roles support
Date
Msg-id 20080522134854.GM5505@tamriel.snowman.net
Whole thread Raw
In response to pg_dump roles support  (Stephen Frost <sfrost@snowman.net>)
Responses Re: pg_dump roles support  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pg_dump roles support  (Benedek László <laci@benedekl.tvnetwork.hu>)
List pgsql-hackers
Greetings,

* Stephen Frost (sfrost@snowman.net) wrote:
>   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:

I've looked into using PGOPTIONS to set the role, and it doesn't seem to
be possible because when we're processing the backend command-line
options we're not yet in a transaction state, so variable.c:assign_role
will always come back with NULL and you get:

vardamir:/home/sfrost> PGOPTIONS="-c role=postgres" psql -d networx -h vardamir
psql: FATAL:  invalid value for parameter "role": "postgres"

In current CVS the relevant lines in variable.c are around 868.  That's
my best guess as to what's happening anyway, I havn't had a chance to
actually hook up a debugger and trace it.

As I discuss above, it'd be really nice have a --role or similar option
to ask pg_dump to set role to a particular user before dumping the
database.
Thanks!
    Stephen

pgsql-hackers by date:

Previous
From: "Amit jain"
Date:
Subject: Error while executing pg_dump "invalid memory alloc request size 4294967293"
Next
From: Gregory Stark
Date:
Subject: Re: idea: storing view source in system catalogs