Re: Add support to COMMENT ON CURRENT DATABASE

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add support to COMMENT ON CURRENT DATABASE
Date: 2017-01-26 18:20:54
Message-ID: CAFcNs+rvT_nEJbjyTcLrMUg7x17hd=DQeOriTGEQRo1uik1j1A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 9, 2017 at 6:14 PM, Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>
> On 1/9/17 1:34 PM, Robert Haas wrote:
> > On Fri, Jan 6, 2017 at 7:29 PM, Peter Eisentraut
> > <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> >> On 1/3/17 11:52 PM, Ashutosh Bapat wrote:
> >>> We will need to make CURRENT_DATABASE a reserved keyword. But I like
> >>> this idea more than COMMENT ON CURRENT DATABASE.
> >>
> >> We already have the reserved key word CURRENT_CATALOG, which is the
> >> standard spelling. But I wouldn't be bothered if we made
> >> CURRENT_DATABASE somewhat reserved as well.
> >
> > Maybe I'm just lacking in imagination, but what's the argument against
> > spelling it CURRENT DATABASE?
>
> To achieve consistent support for specifying the current database, we
> would need to change the grammar for every command involving databases.
> And it would also set a precedent for similar commands, such as current
> user/role. Plus support in psql, pg_dump, etc. would get more
complicated.
>
> Instead, it would be simpler to define a grammar symbol like
>
> database_name: ColId | CURRENT_DATABASE
>
> and make a small analogous change in objectaddress.c and you're done.
>
> Compare rolespec in gram.y.
>

Ok, but doing in that way the syntax would be:

COMMENT ON DATABASE CURRENT_DATABASE IS 'comment';

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 Andres Freund 2017-01-26 18:21:28 Re: [PATCH] Rename pg_switch_xlog to pg_switch_wal
Previous Message Robert Haas 2017-01-26 18:16:13 Re: increasing the default WAL segment size