Re: [HACKERS] identity columns - Mailing list pgsql-hackers

From Robert Haas
Subject Re: [HACKERS] identity columns
Date
Msg-id CA+TgmoY3coh329FX6c-iFLYcCSDc46eZZ5_SB1hh7zMus1Qp3w@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] identity columns  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
List pgsql-hackers
On Sun, Apr 23, 2017 at 9:03 PM, Vitaly Burovoy
<vitaly.burovoy@gmail.com> wrote:
>> But why do we need it?  Instead of:
>>
>> ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
>> SET GENERATED { ALWAYS | BY DEFAULT }
>> DROP IDENTITY [ IF EXISTS ]
>>
>> Why not just:
>>
>> SET GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY
>> DROP IDENTITY [ IF EXISTS ]
>>
>> Surely the ALTER TABLE command can tell whether the column is already
>> GENERATED, so the first form could make it generated if it's not and
>> adjust the ALWAYS/BY DEFAULT property if it is.
>
> I thought exactly that way, but Peter gave an explanation[1].

That's not really an explanation.  Peter says he needs ADD to make
pg_dump, but he doesn't really.  He just needs something that adds it,
and augmenting SET to perform ADD if the sequence is not currently
GENERATED would be fine.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [HACKERS] OK, so culicidae is *still* broken
Next
From: Robert Haas
Date:
Subject: Re: [HACKERS] TAP tests - installcheck vs check