Re: [SQL] begin/end/abort work for sequences?

From: Kyle Bateman <kyle(at)actarg(dot)com>
To: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] begin/end/abort work for sequences?
Date: 1999-07-01 23:29:40
Message-ID: 377BF9E4.975A808E@actarg.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"D'Arcy J.M. Cain" wrote:

> Thus spake Kyle Bateman
> > Do you know if there is a workaround? In my particular situation, it is critical
> > that all instances of the sequence actually get used. If a transaction is
> > aborted, I lose an instance and everything gets messed up.
>
> I had to solve this once in another RDBMS (Progress) and this is how I
> did it. I had a table of available sequence numbers consisting of two
> fields, a name and a number. The table was seeded with 10 entries for
> each required sequence numbered 1 to 10. When I needed a sequence I
> started a transaction and grabbed and locked the lowest numbered record
> for that sequence that wasn't locked. I save the number then add 10 to
> it. If I abort the transaction, the number remains unchanged. Under
> this scheme 10 users can be working on the same sequence without locking
> others out. Numbers can be used out of sequence from time to time if
> someone aborts but they all get used eventually.
>
> --
> D'Arcy J.M. Cain <darcy(at){druid|vex}.net> | Democracy is three wolves
> http://www.druid.net/darcy/ | and a sheep voting on
> +1 416 424 2871 (DoD#0082) (eNTP) | what's for dinner.

Thanks for taking the time to reply!

--
----------------------------------------------------
Kyle Bateman President, Action Target Inc.
"Viva Yo!" kyle(at)actarg(dot)com (801)377-8033x101
----------------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message webmaster 1999-07-02 11:25:27 Re: [SQL] Beginner's headache of joins
Previous Message blackgr 1999-07-01 21:17:35 problem creating table