Re: [HACKERS] [GENERAL] Bug with sequence

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Thomas O'Connell" <tfo(at)monsterlabs(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [HACKERS] [GENERAL] Bug with sequence
Date: 2002-11-21 19:30:14
Message-ID: 13787.1037907014@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

"Thomas O'Connell" <tfo(at)monsterlabs(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message dev 2002-11-21 19:35:41 Re: &main::execute undefined?
Previous Message Tom Lane 2002-11-21 19:28:40 Re: Selecting distinct records

Browse pgsql-hackers by date

  From Date Subject
Next Message scott.marlowe 2002-11-21 20:09:50 Re: [HACKERS] [GENERAL] Bug with sequence
Previous Message Rod Taylor 2002-11-21 19:22:46 Re: [HACKERS] [GENERAL] Bug with sequence

Browse pgsql-sql by date

  From Date Subject
Next Message scott.marlowe 2002-11-21 20:09:50 Re: [HACKERS] [GENERAL] Bug with sequence
Previous Message Rod Taylor 2002-11-21 19:22:46 Re: [HACKERS] [GENERAL] Bug with sequence