On Wed, Oct 27, 2004 at 09:29:21PM -0400, Tom Lane wrote:
> Alvaro Herrera <[EMAIL PROTECTED]> writes:
> > On Wed, Oct 27, 2004 at 04:21:53PM -0400, Tom Lane wrote:
> >> On the other hand, it's also a pretty minor issue, and if it turns out
> >> to require a lot of code rejiggering to make it do that, I'd not think
> >> it worthwhile.
>
> > Patch attached. It passes the regression tests. It shouldn't have
> > secondary effects, but please test.
>
> Wouldn't it be better to just stay in TBLOCK_STARTED state, as if the
> COMMIT were just some random utility command?
It's the same thing, because CommitTransactionCommand acts identically
either way. I changed it anyway because it seems simpler.
--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
Licensee shall have no right to use the Licensed Software
for productive or commercial use. (Licencia de StarOffice 6.0 beta)
Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /home/alvherre/cvs/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.192
diff -c -r1.192 xact.c
*** src/backend/access/transam/xact.c 16 Oct 2004 18:57:22 -0000 1.192
--- src/backend/access/transam/xact.c 30 Oct 2004 18:18:16 -0000
***************
*** 2537,2552 ****
break;
/*
! * here, the user issued COMMIT when not inside a transaction.
! * Issue a WARNING and go to abort state. The upcoming call
! * to CommitTransactionCommand() will then put us back into
! * the default state.
*/
case TBLOCK_STARTED:
ereport(WARNING,
(errcode(ERRCODE_NO_ACTIVE_SQL_TRANSACTION),
errmsg("there is no transaction in
progress")));
! s->blockState = TBLOCK_ABORT_PENDING;
break;
/* These cases are invalid. */
--- 2537,2552 ----
break;
/*
! * The user issued COMMIT when not inside a transaction.
Issue a
! * WARNING, staying in TBLOCK_STARTED state. The upcoming
call to
! * CommitTransactionCommand() will then close the transaction
and
! * put us back into the default state.
*/
case TBLOCK_STARTED:
ereport(WARNING,
(errcode(ERRCODE_NO_ACTIVE_SQL_TRANSACTION),
errmsg("there is no transaction in
progress")));
! result = true;
break;
/* These cases are invalid. */
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings