Re: pg_dump roles support

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_dump roles support
Date: 2008-05-25 18:41:39
Message-ID: 15061.1211740899@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
>> 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"

FWIW, I found by experimentation that ALTER USER ... SET ROLE does work
to cause a SET ROLE at login, though that might be a bit useless for
your purposes --- you'd more or less need a dedicated userid for
pg_dump.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2008-05-25 18:58:17 Re: \df displaying volatility
Previous Message Tom Lane 2008-05-25 18:33:34 Re: [HACKERS] WITH RECURSIVE patch V0.1