Re: Invoice number - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Invoice number
Date
Msg-id Pine.BSF.4.21.0012210905420.86012-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Invoice number  (Kaare Rasmussen <kar@webline.dk>)
List pgsql-sql
> I'm wondering how people creates guaranteed sequential numbers - in my case 
> for invoice numbers.
> 
> - Sequences are not rollback'able.
> - It seems overkill to have a table just for this.
> - What else?

You'll probably need a table (although you may be able to get away with
only one for all of these you want to do).  The big issue here is locking
since a second transaction looking to get a number needs to wait for 
an earlier transaction that has already gotten a number to either commit
or rollback to reuse the number if necessary.



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_dump Error
Next
From: Stephan Szabo
Date:
Subject: Re: Create table doesn't work in plpgsql