Re: [HACKERS] BEGIN inside transaction should be an error

From: "Gurjeet Singh" <singh(dot)gurjeet(at)gmail(dot)com>
To: Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] BEGIN inside transaction should be an error
Date: 2006-05-26 16:00:22
Message-ID: 65937bea0605260900q163fbc24ie9294089246adce9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On 5/26/06, Alvaro Herrera <alvherre(at)commandprompt(dot)com> wrote:
> Gurjeet Singh wrote:
> > I wish to
> > know the standard procedure (command) to generate a patch; and from
> > which level in the source directory should I execute it?
>
> The toplevel directory. The command is
>
> cvs -q diff -cp
>
> If you created new files to implement a patch, include them separately,
> indicating in the patch description in which directory they are meant to
> reside.

Thanks.

Here's the patch:

Index: src/backend/access/transam/xact.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.220
diff -c -p -r1.220 xact.c
*** src/backend/access/transam/xact.c 25 Apr 2006 00:25:17 -0000 1.220
--- src/backend/access/transam/xact.c 21 May 2006 15:40:00 -0000
*************** bool XactReadOnly;
*** 59,64 ****
--- 59,65 ----
int CommitDelay = 0; /* precommit delay in microseconds */
int CommitSiblings = 5; /* # concurrent xacts needed to sleep */

+ bool BeginInXactIsError = true;

/*
* transaction states - transaction state from server perspective
*************** BeginTransactionBlock(void)
*** 2725,2731 ****
case TBLOCK_SUBINPROGRESS:
case TBLOCK_ABORT:
case TBLOCK_SUBABORT:
! ereport(WARNING,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
errmsg("there is already a transaction in progress")));
break;
--- 2726,2732 ----
case TBLOCK_SUBINPROGRESS:
case TBLOCK_ABORT:
case TBLOCK_SUBABORT:
! ereport(ERROR,
(errcode(ERRCODE_ACTIVE_SQL_TRANSACTION),
errmsg("there is already a transaction in progress")));
break;
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.318
diff -c -p -r1.318 guc.c
*** src/backend/utils/misc/guc.c 2 May 2006 11:28:55 -0000 1.318
--- src/backend/utils/misc/guc.c 21 May 2006 15:14:22 -0000
***************
*** 65,70 ****
--- 65,71 ----
#include "utils/pg_locale.h"
#include "pgstat.h"
#include "access/gin.h"
+ #include "access/xact.h"

#ifndef PG_KRB_SRVTAB
#define PG_KRB_SRVTAB ""
*************** static struct config_bool ConfigureNames
*** 1005,1010 ****
--- 1006,1021 ----
false, NULL, NULL
},

+ {
+ {"begin_inside_transaction_is_error", PGC_USERSET, COMPAT_OPTIONS,
+ gettext_noop("A BEGIN statement inside a transaction raises ERROR."),
+ gettext_noop("It is provided to catch buggy applications. "
+ "Disable it to let the buggy application run.")
+ },
+ &BeginInXactIsError,
+ true, NULL, NULL
+ },
+
/* End-of-list marker */
{
{NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL
Index: src/include/access/xact.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/access/xact.h,v
retrieving revision 1.82
diff -c -p -r1.82 xact.h
*** src/include/access/xact.h 25 Apr 2006 00:25:19 -0000 1.82
--- src/include/access/xact.h 21 May 2006 15:13:10 -0000
*************** extern int XactIsoLevel;
*** 41,46 ****
--- 41,49 ----
extern bool DefaultXactReadOnly;
extern bool XactReadOnly;

+ /* A BEGIN statement inside a transaction raises ERROR */
+ extern bool BeginInXactIsError;
+
/*
* start- and end-of-transaction callbacks for dynamically loaded modules
*/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gurjeet Singh 2006-05-26 16:15:25 Re: [HACKERS] BEGIN inside transaction should be an error
Previous Message Andreas Pflug 2006-05-26 15:55:19 Re: Inefficient bytea escaping?

Browse pgsql-patches by date

  From Date Subject
Next Message Gurjeet Singh 2006-05-26 16:15:25 Re: [HACKERS] BEGIN inside transaction should be an error
Previous Message Andrew Dunstan 2006-05-26 15:45:40 Re: [HACKERS] BEGIN inside transaction should be an error