'begin transaction' new syntax bug?

Поиск
Список
Период
Сортировка
Искать

'begin transaction' new syntax bug?

От:
Fabien COELHO <coelho@cri.ensmp.fr>
Дата:

It seems to me that new 'begin isolation level ...' syntax does not work
with current cvs head:

#
# old syntax:
#
psql> SELECT VERSION();                         version
---------------------------------------------------------------------------PostgreSQL 7.5devel on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.3
(Debian 20040401)

psql> BEGIN;
BEGIN
psql> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
SET
psql> SHOW TRANSACTION ISOLATION LEVEL;transaction_isolation
-----------------------serializable


#
# new syntax?
#

psql> BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
BEGIN
psql> SHOW TRANSACTION ISOLATION LEVEL;transaction_isolation
-----------------------read committed


I would have expected 'serializable' ?

"If the isolation level or read/write mode is specified, the new
transaction has those characteristics, as if SET TRANSACTION was
executed."

-- 
Fabien Coelho - coelho@cri.ensmp.fr

Re: 'begin transaction' new syntax bug?

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Fabien COELHO wrote:
> #
> # new syntax?
> #
> 
> psql> BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
> BEGIN
> psql> SHOW TRANSACTION ISOLATION LEVEL;
>  transaction_isolation
> -----------------------
>  read committed

OK, fixed:

	test=> BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
	BEGIN
	test=> SHOW TRANSACTION ISOLATION LEVEL;
	 transaction_isolation
	-----------------------
	 serializable
	(1 row)

I added the ability to use such clauses to BEGIN in January for 7.5, but
I never tested it using SHOW.  I thought the START TRANSACTION and BEGIN
code would handle the clause code the same, but BEGIN was ignoring it.

Patch attached and applied.

Thanks for the report.

-- 
  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/tcop/utility.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/tcop/utility.c,v
retrieving revision 1.211
diff -c -c -r1.211 utility.c
*** src/backend/tcop/utility.c	23 Mar 2004 19:35:17 -0000	1.211
--- src/backend/tcop/utility.c	19 Apr 2004 21:16:57 -0000
***************
*** 302,316 ****
  
  				switch (stmt->kind)
  				{
  					case TRANS_STMT_BEGIN:
- 						BeginTransactionBlock();
- 						break;
- 
- 						/*
- 						 * START TRANSACTION, as defined by SQL99:
- 						 * Identical to BEGIN, except that it takes a few
- 						 * additional options.
- 						 */
  					case TRANS_STMT_START:
  						{
  							BeginTransactionBlock();
--- 302,313 ----
  
  				switch (stmt->kind)
  				{
+ 					/*
+ 					 * START TRANSACTION, as defined by SQL99:
+ 					 * Identical to BEGIN, except that it takes a few
+ 					 * additional options.  Same code for both.
+ 					 */
  					case TRANS_STMT_BEGIN:
  					case TRANS_STMT_START:
  						{
  							BeginTransactionBlock();
Index: src/backend/utils/misc/guc.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/utils/misc/guc.c,v
retrieving revision 1.199
diff -c -c -r1.199 guc.c
*** src/backend/utils/misc/guc.c	7 Apr 2004 18:52:26 -0000	1.199
--- src/backend/utils/misc/guc.c	19 Apr 2004 21:17:01 -0000
***************
*** 3394,3399 ****
--- 3394,3401 ----
  SetPGVariable(const char *name, List *args, bool is_local)
  {
  	char	   *argstring = flatten_set_variable_args(name, args);
+ printf("bjm:  %s %s\n", name, argstring);
+ fflush(stdout);
  
  	/* Note SET DEFAULT (argstring == NULL) is equivalent to RESET */
  	set_config_option(name,

Re: 'begin transaction' new syntax bug?

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Please ignore the 'bjm' debug code that was part of the patch.  It has
been removed from CVS.

--  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

Re: 'begin transaction' new syntax bug?

От:
Christopher Kings-Lynne <chriskl@familyhealth.com.au>
Дата:
>   	char	   *argstring = flatten_set_variable_args(name, args);
> + printf("bjm:  %s %s\n", name, argstring);
> + fflush(stdout);
>   

Did you really mean to include that? :)

Chris


Re: 'begin transaction' new syntax bug?

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Christopher Kings-Lynne wrote:
> >   	char	   *argstring = flatten_set_variable_args(name, args);
> > + printf("bjm:  %s %s\n", name, argstring);
> > + fflush(stdout);
> >   
> 
> Did you really mean to include that? :)

Nope, posted a followup that it was removed in a later commit.

--  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

FAQ