Skip site navigation (1) Skip section navigation (2)

Re: New version of GENERATED/IDENTITY, was Re: parser dilemma

From: Zoltan Boszormenyi <zb(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, List pgsql-patches <pgsql-patches(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, "Florian G(dot) Pflug" <fgp(at)phlo(dot)org>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: New version of GENERATED/IDENTITY, was Re: parser dilemma
Date: 2007-04-26 17:32:02
Message-ID: 4630E212.1090205@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Hi,

some last changes. Really. :-)

I made ALTER TABLE symmetric with CREATE TABLE
so the grammar now has:

ALTER TABLE tabname ALTER colname SET GENERATED
   { ALWAYS | BY DEFAULT} AS IDENTITY [ ( sequence options )]

This works intuitively the same as in CREATE TABLE, i.e.
- it creates an OWNED sequence (if the column doesn't already have one)
- it creates or alters the sequence with the given options
- adds the DEFAULT expression with the proper generation behaviour
in one go. I extended the documentation and modified the test case 
accordingly.
I also tested that an IDENTITY column can't be created with a type that
cannot be cast from bigint i.e. box. I added it to the test case.

Please, review.

Best regards,
Zoltán Böszörményi

Zoltan Boszormenyi írta:
> And here it is attached. Sorry.
>
> Zoltan Boszormenyi írta:
>> Hi,
>>
>> here's the patch with the modifications suggested by Tom Lane.
>> The postfix rule was deleted from b_expr and the reverse parsing
>> in ruleutils.c::get_oper_expr() always puts parentheses around
>> postfix operators.
>>
>> Other changes:
>> - OVERRIDING SYSTEM VALUE in COPY can appear
>>   at any place in the option list.
>> - pg_dump was modified accordingly
>> - \copy built-in in psql now also accepts OVERRIDING SYSTEM VALUE
>> - documentation and testcase updates
>>
>> Please, review.
>>
>> Best regards,
>> Zoltán Böszörményi
>>
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>   


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


Attachment: psql-serial-44.diff.gz
Description: application/x-tar (30.6 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2007-04-26 17:35:42
Subject: Re: ECPG failure on BF member Vaquita (Windows Vista)
Previous:From: Mark WongDate: 2007-04-26 17:29:47
Subject: Re: ECPG failure on BF member Vaquita (Windows Vista)

pgsql-patches by date

Next:From: Bruce MomjianDate: 2007-04-26 17:36:42
Subject: Re: New version of GENERATED/IDENTITY, was Re: parser dilemma
Previous:From: Zoltan BoszormenyiDate: 2007-04-26 11:24:24
Subject: Re: New version of GENERATED/IDENTITY, was Re: parser dilemma

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group