Re: Can pg_dump make use of CURRENT/SESSION_USER

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Can pg_dump make use of CURRENT/SESSION_USER
Date: 2015-04-28 23:28:28
Message-ID: CAFcNs+oqJh=ygqvDoz0q+t6JoDj-_q5W1-9wie5TYVSxS6XeOg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 28, 2015 at 1:07 PM, Fabrízio de Royes Mello <
fabriziomello(at)gmail(dot)com> wrote:
>
>
> On Tue, Apr 28, 2015 at 9:38 AM, Robert Haas <robertmhaas(at)gmail(dot)com>
wrote:
> >
> > On Sat, Apr 25, 2015 at 8:05 AM, Fabrízio de Royes Mello
> > <fabriziomello(at)gmail(dot)com> wrote:
> > >> >> > If we ever implement something like
> > >> >> >
> > >> >> > COMMENT ON CURRENT_DATABASE IS ...
> > >> >> >
> > >> >> > it will be useful, because you will be able to restore a dump
into
> > >> >> > another database and have the comment apply to the target
database.
> > >> >
> > >> > I think it's simple to implement, but how about pg_dump... we need
to
> > >> > add
> > >> > new option (like --use-current-database) or am I missing something
?
> > >>
> > >> I think we'd just change it to use the new syntax, full stop. I see
> > >> no need for an option.
> > >
> > > I'm returning on this...
> > >
> > > What's the reasonable syntaxes?
> > >
> > > COMMENT ON CURRENT DATABASE IS 'text';
> > >
> > > or
> > >
> > > COMMENT ON DATABASE { CURRENT_DATABASE | object_name } IS 'text';
> >
> > The second one would require making CURRENT_DATABASE a reserved
> > keyword, and I'm not keen to create any more of those. I like the
> > first one. The other alternative that may be worth considering is:
> >
> > COMMENT ON CURRENT_DATABASE IS 'text';
> >
> > That doesn't require making CURRENT_DATABASE a reserved keyword, but
> > it does require making it a keyword, and it doesn't look very SQL-ish.
> > Still, we have a bunch of other CURRENT_FOO keywords.
> >
> > But I'm inclined to stick with your first proposal.
> >
>
> Attached the patch to support "COMMENT ON CURRENT DATABASE IS ..."
(including pg_dump).
>
> On my next spare time I'll send the "ALTER ROLE ... IN CURRENT DATABASE"
patch.
>

Looking at the patch again I realize the code is very ugly, so I'll rework
the patch.

Regards,

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2015-04-29 00:12:21 Re: pg_basebackup, tablespace mapping and path canonicalization
Previous Message Andrew Dunstan 2015-04-28 23:14:04 Re: shared_libperl, shared_libpython