On Mon, Jan 9, 2017 at 3:14 PM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> To achieve consistent support for specifying the current database, we
> would need to change the grammar for every command involving databases.
I wouldn't have thought there would be all that many of those, though.
> And it would also set a precedent for similar commands, such as current
> user/role.
True. Maybe it's a GOOD precedent, though.
> Plus support in psql, pg_dump, etc. would get more complicated.
I'm not totally convinced...
> 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.
...but that's certainly an existing precedent for your proposal.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company