Re: [PATCHES] [HACKERS] Connection Pools and DISCARD ALL

2007-11-09 Thread Simon Riggs
On Thu, 2007-11-08 at 21:50 -0500, Bruce Momjian wrote:
 Tom Lane wrote:
  Andrew Dunstan [EMAIL PROTECTED] writes:
   Could we maybe have some flavor of ROLLBACK that doesn't issue a warning 
   if no transaction is in progress? There is precedent for this sort of 
   facility - DROP ... IF EXISTS.
  
  Something that would actually be doable for 8.3 would be to downgrade
  this particular WARNING to a NOTICE.  A DBA who hasn't got
  log_min_messages set higher than NOTICE hasn't really got a lot of room
  to whine about bulky logs.
 
 I have developed the attached patch to implement this.  I assume we want
 to change ABORT outside a transaction from WARNING to NOTICE, but not
 COMMIT.

Patch looks fine to me. 

I've been trying to track down the code in the PHP interface that issues
it and see if we can make a version specific change. The code I'm
looking at now has already got that change, so I'm trying to understand
whether or not it works correctly.

But either way, I think the change is appropriate.

-- 
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com


---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq


Re: [PATCHES] [HACKERS] Connection Pools and DISCARD ALL

2007-11-08 Thread Bruce Momjian
Tom Lane wrote:
 Andrew Dunstan [EMAIL PROTECTED] writes:
  Could we maybe have some flavor of ROLLBACK that doesn't issue a warning 
  if no transaction is in progress? There is precedent for this sort of 
  facility - DROP ... IF EXISTS.
 
 Something that would actually be doable for 8.3 would be to downgrade
 this particular WARNING to a NOTICE.  A DBA who hasn't got
 log_min_messages set higher than NOTICE hasn't really got a lot of room
 to whine about bulky logs.

I have developed the attached patch to implement this.  I assume we want
to change ABORT outside a transaction from WARNING to NOTICE, but not
COMMIT.

-- 
  Bruce Momjian  [EMAIL PROTECTED]http://momjian.us
  EnterpriseDB http://postgres.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/access/transam/xact.c
===
RCS file: /cvsroot/pgsql/src/backend/access/transam/xact.c,v
retrieving revision 1.251
diff -c -c -r1.251 xact.c
*** src/backend/access/transam/xact.c	11 Sep 2007 03:28:05 -	1.251
--- src/backend/access/transam/xact.c	9 Nov 2007 02:45:30 -
***
*** 3025,3031 
  			 * 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;
--- 3025,3031 
  			 * default state.
  			 */
  		case TBLOCK_STARTED:
! 			ereport(NOTICE,
  	(errcode(ERRCODE_NO_ACTIVE_SQL_TRANSACTION),
  	 errmsg(there is no transaction in progress)));
  			s-blockState = TBLOCK_ABORT_PENDING;
Index: src/test/regress/expected/errors.out
===
RCS file: /cvsroot/pgsql/src/test/regress/expected/errors.out,v
retrieving revision 1.52
diff -c -c -r1.52 errors.out
*** src/test/regress/expected/errors.out	15 Apr 2006 17:45:46 -	1.52
--- src/test/regress/expected/errors.out	9 Nov 2007 02:45:31 -
***
*** 116,122 
   
  -- not in a xact 
  abort;
! WARNING:  there is no transaction in progress
  -- not in a xact 
  end;
  WARNING:  there is no transaction in progress
--- 116,122 
   
  -- not in a xact 
  abort;
! NOTICE:  there is no transaction in progress
  -- not in a xact 
  end;
  WARNING:  there is no transaction in progress

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faq