(unnamed)

text/plain

Filename: (unnamed)
Type: text/plain
Part: 0
Message: AtAbort_Portsl problem
Index: src/backend/utils/mmgr/portalmem.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/mmgr/portalmem.c,v
retrieving revision 1.115
diff -c -r1.115 portalmem.c
*** src/backend/utils/mmgr/portalmem.c	2 Jan 2010 16:57:58 -0000	1.115
--- src/backend/utils/mmgr/portalmem.c	17 Jan 2010 13:19:07 -0000
***************
*** 684,689 ****
--- 684,700 ----
  			PortalReleaseCachedPlan(portal);
  
  		/*
+ 		 * Remove the reference to PlannedStmts and/or utility
+ 		 * statements.  This is neccessary since
+ 		 * PortalReleaseCachedPlan might release memory context which
+ 		 * stmts belogs to and subsequent call to exec_execute_message
+ 		 * looks into stmts to check if it's a transaction
+ 		 * command(which is allow to call even if in an aborted
+ 		 * transaction state), which might refer to freed memory.
+ 		 */
+ 		portal->stmts = NULL;
+ 
+ 		/*
  		 * Any resources belonging to the portal will be released in the
  		 * upcoming transaction-wide cleanup; they will be gone before we run
  		 * PortalDrop.