Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Stevenson
> >People who have not studied the documentation frequently make that >claim. *There is no such risk* (unless A and B are interleaving their >commands on a single database connection, in which case they have lots >worse risks of conflicts than this one). See >http://www.ca.postgresql.org/users-l

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Tom Lane
Joel Stevenson <[EMAIL PROTECTED]> writes: > Though, if you have multiple clients inserting into the table, there > is a chance that between client A inserting the record and then > calling currval(), client B could have performed an insert, in which > case client A gets the value of client B's

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Stevenson
> > "You say nextval() + write, I say write + currval()..." > >So long as a given application does not mix the two approaches, everything >should be fine. Though, if you have multiple clients inserting into the table, there is a chance that between client A inserting the record and then callin

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Brian McCane
2, Joel Burton wrote: > > > -Original Message- > > From: Dan Langille [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 06, 2002 12:41 PM > > To: Joel Burton > > Cc: [EMAIL PROTECTED] > > Subject: Re: [ADMIN] SERIAL Field > > > >

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Dan Langille
On 6 May 2002 at 12:43, Joel Burton wrote: > > -Original Message- > > From: Dan Langille [mailto:[EMAIL PROTECTED]] > > Sent: Monday, May 06, 2002 12:41 PM > > To: Joel Burton > > Cc: [EMAIL PROTECTED] > > Subject: Re: [ADMIN] SERIAL Field > >

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Burton
> -Original Message- > From: Dan Langille [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 06, 2002 12:41 PM > To: Joel Burton > Cc: [EMAIL PROTECTED] > Subject: Re: [ADMIN] SERIAL Field > > > In any event, inserting then using currval() is the standard pract

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Dan Langille
On 6 May 2002 at 10:51, Joel Burton wrote: > > But the very idea of inserting the value and then retriving the sequence > > number sounds fishy to me. Why not get the sequence number first and than > > insert using that seqnce number (more on the flash tutorial ). That's pretty standard in a num

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Burton
> -Original Message- > From: Joel Burton [mailto:[EMAIL PROTECTED]] > Sent: Monday, May 06, 2002 10:51 AM > To: Rajesh Kumar Mallah.; Gaetano Mendola; [EMAIL PROTECTED] > Subject: RE: [ADMIN] SERIAL Field > > > > -Original Message- > > From: [EM

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Burton
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Rajesh Kumar > Mallah. > Sent: Monday, May 06, 2002 9:26 AM > To: Gaetano Mendola; [EMAIL PROTECTED] > Subject: Re: [ADMIN] SERIAL Field > But the very idea of inserting the

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Rajesh Kumar Mallah.
Hi Gaetano, Postgresql implements serial field using sequences. detailed description of sequences are avaliable at http://www.postgresql.org/idocs/index.php?functions-sequence.html a NICE flash tutorial is also available at: http://techdocs.postgresql.org/college/001_sequences/ the specific a

Re: [ADMIN] SERIAL Field

2002-05-06 Thread Joel Burton
> Hi all, > > having a table with a serial field what is the corrected method > to retrieve the value after an insert ? Use currval(_name_of_sequence_): joel=# create table test ( id serial ); NOTICE: CREATE TABLE will create implicit sequence 'test_id_seq' for SERIAL column 'test.id' NOTICE: