

> > Peter Eisentraut wrote:
> > 
> > > Bruce Momjian writes:
> > > 
> > > >       * Add function to return primary key value on INSERT
> > > 
> > > I don't get the point of this. Don't you know what you 
> inserted? For
> > > sequences there's curval()
> > 
> > Mmmhhh... it means that we can assume no update to the 
> sequence value
> > between the insert and the curval selection?
> 
> No curval() is per-backend value that is not affected by other users. 
> My book has a mention of that issue, and so does the FAQ.

Not all default values need to be a sequence, thus imho
this function is a useful extension. ODBC has it too.

Andreas

Mon, 10 Jul 2000 15:38:56 +0200
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>
AW: Re: postgres TODO
On Mon, 10 Jul 2000, Zeugswetter Andreas SB wrote:

> 
> 
> > > Peter Eisentraut wrote:
> > > 
> > > > Bruce Momjian writes:
> > > > 
> > > > >       * Add function to return primary key value on INSERT
> > > > 
> > > > I don't get the point of this. Don't you know what you 
> > inserted? For
> > > > sequences there's curval()
> > > 
> > > Mmmhhh... it means that we can assume no update to the 
> > sequence value
> > > between the insert and the curval selection?
> > 
> > No curval() is per-backend value that is not affected by other users. 
> > My book has a mention of that issue, and so does the FAQ.
> 
> Not all default values need to be a sequence, thus imho
> this function is a useful extension. ODBC has it too.

actually, had thought about this too over the weekend ... if I define a
'serial' type, it right now creates a sequence for that ... if I recall
correctly, that was purely a kludge until someone built a better 'serial'
...

having an INSERT return the value of 'serial' that was used would save a
second SELECT call *and* eliminate the requirement for an app programmer
to have to know to do a 'SELECT curval('table_field_seq');' ...



Mon, 10 Jul 2000 11:44:29 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
Re: AW: Re: postgres TODO
> actually, had thought about this too over the weekend ... if I define a
> 'serial' type, it right now creates a sequence for that ... if I recall
> correctly, that was purely a kludge until someone built a better 'serial'
> ...
> 
> having an INSERT return the value of 'serial' that was used would save a
> second SELECT call *and* eliminate the requirement for an app programmer
> to have to know to do a 'SELECT curval('table_field_seq');' ...

Yes, I can imagine that the table_field_seq name is kind of flakey.  It
will choose a different name if there is a conflict, so it is an chance
for failure.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Mon, 10 Jul 2000 15:01:20 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: AW: Re: postgres TODO