Re: Change the behaviour of the SERIAL "Type" - Mailing list pgsql-sql

From Dani Oderbolz
Subject Re: Change the behaviour of the SERIAL "Type"
Date
Msg-id 3EFC0413.7090006@ecologic.de
Whole thread Raw
In response to Re: Change the behaviour of the SERIAL "Type"  (Randall Lucas <rlucas@tercent.net>)
Responses Re: Change the behaviour of the SERIAL "Type"
List pgsql-sql
Randall Lucas wrote:

>
> Wow, I had never actually faced this problem (yet) but I spied it as a 
> possible stumbling block for porting MySQL apps, for which the 
> standard practice is inserting a NULL.  As I have made a fairly 
> thorough reading of the docs (but may have not cross-correlated every 
> piece of data yet, obviously), I was surprised to find I hadn't 
> figured this out myself.  It /seems/ obvious in retrospect, but it 
> really baked my noodle when I first looked at some ugly MySQL queries.
>
> Respectfully, then, I move that a sentence outlining this 
> functionality be added to User Manual section 5.1.4, "The Serial 
> Types."  Furthermore, anyone who has written or is writing a MySQL 
> porting guide should include this, if he hasn't. 

Yea, fine, but I propose a different (deeper) approach.
Why does SERIAL only enforce a DEFAULT?
This is not an exact imitation of an autoincrement, as a DEFAULT can be 
overwritten.
In my oppinion, SERIAL should implicitly create a Trigger on the table, 
which then
handles this transparently.
Would that be difficult?
(I am already writing a Procedure which gets all the info needed out of 
the Catalog,
but my problem is that I need some dynamic statements in there...)

Cheers, Dani




pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: Postgres - Delphi Application
Next
From: Tomasz Myrta
Date:
Subject: Re: Postgres - Delphi Application