Re: [HACKERS] [GENERAL] Bug with sequence - Mailing list pgsql-sql

From Tom Lane
Subject Re: [HACKERS] [GENERAL] Bug with sequence
Date
Msg-id 13787.1037907014@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Bug with sequence  (Thomas O'Connell <tfo@monsterlabs.com>)
List pgsql-sql
"Thomas O'Connell" <tfo@monsterlabs.com> writes:
> It seems worth pointing out, too, that some SQL purists propose not 
> relying on product-specific methods of auto-incrementing.
> I.e., it is possible to do something like:
> insert into foo( col, ... )
> values( coalesce( ( select max( col ) from foo ), 0 ) + 1, ... );
> and this is easily placed in a trigger.

... but that approach is entirely unworkable if you want any concurrency
of insert operations.  (Triggers are a tad product-specific, too :-()
        regards, tom lane


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] [GENERAL] Bug with sequence
Next
From: Rod Taylor
Date:
Subject: Re: [HACKERS] [GENERAL] Bug with sequence