Re: [INTERFACES] locking on database updates - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] locking on database updates
Date
Msg-id 20458.944529261@sss.pgh.pa.us
Whole thread Raw
In response to locking on database updates  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
List pgsql-interfaces
Gary Stainburn <gary.stainburn@ringways.co.uk> writes:
> My question is this.  Is there a safe way of retrieving the next
> number from the parameter table in such a way that the same number
> cannot be retrieved twice.

Use a SEQUENCE object for each "parameter table".  This gives you 
a well-tested, efficient generator mechanism.  It may be "auto
generated" but you do have the option of resetting the sequence's
nextval and so forth, so I don't see that there is a good reason
to build a SEQUENCE substitute by hand.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Rich Shepard
Date:
Subject: Re: [INTERFACES] locking on database updates
Next
From: Joseph Shraibman
Date:
Subject: Re: [INTERFACES] locking on database updates