Re: SERIAL Field

From: "Joel Burton" <joel(at)joelburton(dot)com>
To: "Rajesh Kumar Mallah(dot)" <mallah(at)trade-india(dot)com>, "Gaetano Mendola" <mendola(at)bigfoot(dot)com>, <pgsql-admin(at)postgresql(dot)org>
Subject: Re: SERIAL Field
Date: 2002-05-06 14:51:21
Message-ID: JGEPJNMCKODMDHGOBKDNKEPJCMAA.joel@joelburton.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> -----Original Message-----
> From: pgsql-admin-owner(at)postgresql(dot)org
> [mailto:pgsql-admin-owner(at)postgresql(dot)org]On Behalf Of Rajesh Kumar
> Mallah.
> Sent: Monday, May 06, 2002 9:26 AM
> To: Gaetano Mendola; pgsql-admin(at)postgresql(dot)org
> Subject: Re: [ADMIN] SERIAL Field

> 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 ).

Hmmm... does nextval() 'hold' a sequence number for this backend? Otherwise,
the risk would be that you request a value, and someone else has beat you to
it before you insert it.

In any event, inserting then using currval() is the standard practice around
here, and it works great. Nothing fishy at all here, nothing to see, move
on.

J.

Joel BURTON | joel(at)joelburton(dot)com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Joel Burton 2002-05-06 14:57:19 Re: SERIAL Field
Previous Message Mark McEahern 2002-05-06 14:23:11 Re: configure datatype name > 31?