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

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Kyle Bateman <kyle(at)actarg(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org, "[Jos_] Soares" <jose(at)sferacarta(dot)com>
Subject: Re: [SQL] begin/end/abort work for sequences?
Date: 1999-07-01 15:30:47
Message-ID: 199907011530.LAA02443@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> > If we rolled back sequence numbers, we would have to lock the table
> > until the transaction commited or was rolled back. That is too much
> > locking so was not worth it.
> >
>
> That seems like a pretty big thing to sacrifice. Did sequence locking work before
> 6.5? It was my impression that it did.

No, sequence numbers of aborted transactions never were saved.

> 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 recommend hand-rolling a sequence number, similar to how the sequence
mechanism works, but explicitly lock your sequence table, retrieve the
value, and the commit/abort will unlock the table.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-07-01 16:26:59 Re: [SQL] begin/end/abort work for sequences?
Previous Message Steven Pennie 1999-07-01 14:43:12 Index on Type Numeric