Fix for error in autocommit off - Mailing list pgsql-hackers

From Bruce Momjian
Subject Fix for error in autocommit off
Date
Msg-id 200303192024.h2JKOdD07726@candle.pha.pa.us
Whole thread Raw
Responses Re: Fix for error in autocommit off
List pgsql-hackers
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
Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/access/transam/xact.c,v
retrieving revision 1.143
diff -c -c -r1.143 xact.c
*** src/backend/access/transam/xact.c    14 Mar 2003 22:40:31 -0000    1.143
--- src/backend/access/transam/xact.c    19 Mar 2003 20:13:09 -0000
***************
*** 1341,1347 ****
               */
          case TBLOCK_DEFAULT:
              AbortTransaction();
!             CleanupTransaction();
              break;

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

              /*

pgsql-hackers by date:

Previous
From: Manfred Koizar
Date:
Subject: Re: Nested transactions: low level stuff
Next
From: mlw
Date:
Subject: MySQL at .NET conference