Re: IDENTITY/GENERATED v36 Re: [PATCHES] Final version of IDENTITY/GENERATED patch

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: IDENTITY/GENERATED v36 Re: [PATCHES] Final version of IDENTITY/GENERATED patch
Date: 2007-04-16 18:07:00
Message-ID: 4623BB44.6040805@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane írta:
> Zoltan Boszormenyi <zb(at)cybertec(dot)at> writes:
>
>> Apart from making the patch a bit smaller again, checking only
>> for 'i' still allows multiple SERIALs in the same table but lets
>> disallowing multiple GENERATED ALWAYS AS IDENTITY.
>> Thinking a bit about it, is it desired to disallow multiple GENERATED
>> ALWAYS AS IDENTITY fields? It's just a twisted SERIAL anyway.
>>
>
> I don't see the value of disallowing it.
>

I thought so.

>> Also, DROP IDENTITY is equivalent with SET DEFAULT
>> nextval('owned_sequence') iff the field has an OWNED
>> sequence and it was GENERATED ALWAYS AS IDENTITY before.
>> Considering that SERIAL is a macro, and SET/DROP DEFAULT is allowed
>> on IDENTITY/GENERATED columns per Tom's request,
>> should I keep this statement?
>>
>
> If it's not in the spec I don't see any strong reason to have it...
>

It's not. Removed.

>> Also, the current grammar is made to give a syntax error
>> if you say "colname type GENERATED BY DEFAULT AS ( expr )".
>> But it makes the grammar unbalanced, and gives me:
>> bison -y -d gram.y
>> conflicts: 2 shift/reduce
>>
>
> You'll have to fix that. Usually you can get around it by making the
> grammar a bit more verbose --- if you were trying to avoid duplication
> by means of optional productions, don't do that.
>

What do you mean by "making it more verbose"?

"GENERATED BY DEFAULT AS ( expr )" is another
way of saying "DEFAULT expr" but that being similar
to GENERATED ALWAYS AS ( expr ) would make
the users think that it would permit smarter expressions
than simple DEFAULT would allow. My thought was
to disallow this in the grammar.

BTW, thanks for the quick answer.

--
----------------------------------
Zoltán Böszörményi
Cybertec Geschwinde & Schönig GmbH
http://www.postgresql.at/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aidan Van Dyk 2007-04-16 18:10:32 Re: Hacking on PostgreSQL via GIT
Previous Message Aidan Van Dyk 2007-04-16 17:56:00 Re: Hacking on PostgreSQL via GIT

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-04-16 18:23:56 Re: IDENTITY/GENERATED v36 Re: [PATCHES] Final version of IDENTITY/GENERATED patch
Previous Message Tom Lane 2007-04-16 17:35:59 Re: IDENTITY/GENERATED v36 Re: [PATCHES] Final version of IDENTITY/GENERATED patch