Re: Add support to COMMENT ON CURRENT DATABASE

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add support to COMMENT ON CURRENT DATABASE
Date: 2017-01-04 04:52:40
Message-ID: CAFjFpRe0JVVVL5ZnNH226NPmgEBRnhQq6uxKr23sr7z_+HdPfQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 3, 2017 at 9:18 PM, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 12/30/16 9:28 PM, Fabrízio de Royes Mello wrote:
>> The attached patch is reworked from a previous one [1] to better deal
>> with get_object_address and pg_get_object_address.
>>
>> Regards,
>>
>> [1] https://www.postgresql.org/message-id/20150317171836.GC10492@momjian.us
>
> The syntax we have used for the user/role case is ALTER USER
> CURRENT_USER, not ALTER CURRENT USER, so this should be done in the same
> way for databases. Eventually, we'll also want ALTER DATABASE
> current_database, and probably not ALTER CURRENT DATABASE, etc.

We don't allow a user to be created as CURRENT_USER, but we allow a
database to be created with name CURRENT_DATABASE.
postgres=# create user current_user;
ERROR: CURRENT_USER cannot be used as a role name here
LINE 1: create user current_user;
^
postgres=# create database current_database;
CREATE DATABASE

We will need to make CURRENT_DATABASE a reserved keyword. But I like
this idea more than COMMENT ON CURRENT DATABASE.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2017-01-04 05:07:28 Re: Declarative partitioning - another take
Previous Message Ashutosh Bapat 2017-01-04 04:44:18 Re: Add support to COMMENT ON CURRENT DATABASE