Re: [SQL] next integer in serial key

2004-07-29 Thread terry
The same way the default value is defined, which you can find by doing: \d tablename Which usually gives something like: Table "public.gbs_floorplans" Column| Type |Modifiers --+

Re: [SQL] next integer in serial key

2004-07-22 Thread Stephan Szabo
On Thu, 22 Jul 2004 [EMAIL PROTECTED] wrote: > > > Alternatively, you can do: > > > INSERT (accepting the default) > > > then SELECT currval(the_sequence_object); > > > then > > > > > > NOTE: 2nd method assumes that nobody else called nextval() on the > > > sequence between when you did the > >

Re: [SQL] next integer in serial key

2004-07-22 Thread terry
e- > From: Kenneth Gonsalves [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 22, 2004 7:52 AM > To: Oliver Elphick; [EMAIL PROTECTED] > Cc: Postgresql Sql Group (E-mail) > Subject: Re: [SQL] next integer in serial key > > > On Thursday 22 July 2004 05:45 pm, Oliver Elp

Re: [SQL] next integer in serial key

2004-07-22 Thread Kenneth Gonsalves
On Thursday 22 July 2004 05:45 pm, Oliver Elphick wrote: > On Thu, 2004-07-22 at 12:48, [EMAIL PROTECTED] wrote: > > Actually it does work, call nextval to get your next value, then call > > your INSERT statement, > > explicitly giving said value for the serial column. Then you can > > proceed wit

Re: [SQL] next integer in serial key

2004-07-22 Thread Kenneth Gonsalves
On Thursday 22 July 2004 05:18 pm, [EMAIL PROTECTED] wrote: > Alternatively, you can do: > INSERT (accepting the default) > then SELECT currval(the_sequence_object); > then did this. barf: foreign key not in original table -- regards kg http://www.onlineindianhotels.net - hotel bookings reser

Re: [SQL] next integer in serial key

2004-07-22 Thread terry
> > Alternatively, you can do: > > INSERT (accepting the default) > > then SELECT currval(the_sequence_object); > > then > > > > NOTE: 2nd method assumes that nobody else called nextval() on the > > sequence between when you did the > > insert and when you did the select currval(). Note that > b

Re: [SQL] next integer in serial key

2004-07-22 Thread Oliver Elphick
On Thu, 2004-07-22 at 12:48, [EMAIL PROTECTED] wrote: > Actually it does work, call nextval to get your next value, then call > your INSERT statement, > explicitly giving said value for the serial column. Then you can > proceed with using said value in > the INSERT statement of the related inserts

Re: [SQL] next integer in serial key

2004-07-22 Thread terry
TECTED] > Sent: Thursday, July 22, 2004 12:13 AM > To: [EMAIL PROTECTED] > Subject: Re: [SQL] next integer in serial key > > > On Thursday 22 July 2004 10:25 am, you wrote: > > The same way the default value is defined, which you can > find by doing: > > \d tablenam

Re: [SQL] next integer in serial key

2004-07-21 Thread Oliver Elphick
On Thu, 2004-07-22 at 03:45, Kenneth Gonsalves wrote: > hi, > how does one get the next number in a serial type row? When inserting a new row, do not mention the serial column in the list of columns, or else give it the value DEFAULT. -- Oliver Elphick [E