Received: from www.actarg.com (root@[209.180.91.25]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA59698 for ; Thu, 1 Jul 1999 10:19:40 -0400 (EDT) (envelope-from kyle@actarg.com) Received: from actarg.com (root@tao.actarg.com [192.168.1.1]) by www.actarg.com (8.8.7/8.8.7) with ESMTP id IAA20865; Thu, 1 Jul 1999 08:22:25 -0600 Received: from actarg.com (kyle@chi.actarg.com [192.168.2.16]) by actarg.com (8.8.7/8.8.7) with ESMTP id IAA05965; Thu, 1 Jul 1999 08:19:20 -0600 Sender: kyle@actarg.com Message-ID: <377B7A2F.26209427@actarg.com> Date: Thu, 01 Jul 1999 08:24:47 -0600 From: Kyle Bateman Organization: Action Target Inc X-Mailer: Mozilla 4.6 [en] (X11; I; Linux 2.0.36 i686) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgreSQL.org CC: Bruce Momjian , "[Jos_] Soares" Subject: Re: [SQL] begin/end/abort work for sequences? References: <199907010326.XAA05930@candle.pha.pa.us> Content-Type: multipart/alternative; boundary="------------ACFF0BE975538EB302D571C2" --------------ACFF0BE975538EB302D571C2 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Bruce Momjian wrote: > > > The sequence po_seq is advancing to the next value even though the > > > transaction was aborted. If I put other things like updates, inserts, etc. > > > inside the transaction, they seem to be rolled back OK, but not the > > > update of the sequence. > > > > > > Am I doing something wrong? > > > > No. I can't explain you why but AFAIK sequences don't rollback. > > 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. 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. -- ---------------------------------------------------- Kyle Bateman President, Action Target Inc. "Viva Yo!" kyle@actarg.com (801)377-8033x101 ---------------------------------------------------- --------------ACFF0BE975538EB302D571C2 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Bruce Momjian wrote:
> > The sequence po_seq is advancing to the next value even though the
> > transaction was aborted.  If I put other things like updates, inserts, etc.
> > inside the transaction, they seem to be rolled back OK, but not the
> > update of the sequence.
> >
> > Am I doing something wrong?
>
> No. I can't explain you why but AFAIK sequences don't  rollback.

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.

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.

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