Fix for error in autocommit off

Started by Bruce Momjianabout 23 years ago5 messageshackers
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Tom pointed out a problem with our current error handling with
autocommit off:

SET autocommit TO off;
lkjasdfasdf;
SELECT 1;
COMMIT;

In our current code, SELECT is considred to be in a new transaction.
This patch fixes that by making the SELECT be part of the aborted
transaction. Basically we didn't have proper autocommit handling in the
abort function.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/pgpatches/errortext/plainDownload+5-5
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: Fix for error in autocommit off

Bruce Momjian <pgman@candle.pha.pa.us> writes:

*/
case TBLOCK_DEFAULT:
AbortTransaction();
! if (autocommit)
! CleanupTransaction();
! else
! s->blockState = TBLOCK_ABORT;
break;

You forgot suppressChain...

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Fix for error in autocommit off

I wasn't sure how to handle it. Is the attached patch correct?

---------------------------------------------------------------------------

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

*/
case TBLOCK_DEFAULT:
AbortTransaction();
! if (autocommit)
! CleanupTransaction();
! else
! s->blockState = TBLOCK_ABORT;
break;

You forgot suppressChain...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+516-338
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#3)
Re: Fix for error in autocommit off

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I wasn't sure how to handle it. Is the attached patch correct?

Do I have to wade through a thousand lines of Windows hacks to find out?
suppressChain should force autocommit-on behavior, it's not hard...

regards, tom lane

#5Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#4)
Re: Fix for error in autocommit off

I have suppressChain behaving just like it does in
CommitTransactionCommand(). That should do it.

---------------------------------------------------------------------------

Tom Lane wrote:

Bruce Momjian <pgman@candle.pha.pa.us> writes:

I wasn't sure how to handle it. Is the attached patch correct?

Do I have to wade through a thousand lines of Windows hacks to find out?
suppressChain should force autocommit-on behavior, it's not hard...

regards, tom lane

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073