88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.561 2008/12/13 02:00:19 tgl Exp $
11+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.562 2008/12/13 02:29:21 tgl Exp $
1212 *
1313 * NOTES
1414 * this is the "main" module of the postgres backend and
@@ -732,24 +732,14 @@ pg_plan_query(Query *querytree, int cursorOptions, ParamListInfo boundParams)
732732/*
733733 * Generate plans for a list of already-rewritten queries.
734734 *
735- * If needSnapshot is TRUE, we haven't yet set a snapshot for the current
736- * query. A snapshot must be set before invoking the planner, since it
737- * might try to evaluate user-defined functions. But we must not set a
738- * snapshot if the list contains only utility statements, because some
739- * utility statements depend on not having frozen the snapshot yet.
740- * (We assume that such statements cannot appear together with plannable
741- * statements in the rewriter's output.)
742- *
743735 * Normal optimizable statements generate PlannedStmt entries in the result
744736 * list. Utility statements are simply represented by their statement nodes.
745737 */
746738List *
747- pg_plan_queries (List * querytrees , int cursorOptions , ParamListInfo boundParams ,
748- bool needSnapshot )
739+ pg_plan_queries (List * querytrees , int cursorOptions , ParamListInfo boundParams )
749740{
750741 List * stmt_list = NIL ;
751742 ListCell * query_list ;
752- bool snapshot_set = false;
753743
754744 foreach (query_list , querytrees )
755745 {
@@ -763,22 +753,12 @@ pg_plan_queries(List *querytrees, int cursorOptions, ParamListInfo boundParams,
763753 }
764754 else
765755 {
766- if (needSnapshot && !snapshot_set )
767- {
768- PushActiveSnapshot (GetTransactionSnapshot ());
769- snapshot_set = true;
770- }
771-
772- stmt = (Node * ) pg_plan_query (query , cursorOptions ,
773- boundParams );
756+ stmt = (Node * ) pg_plan_query (query , cursorOptions , boundParams );
774757 }
775758
776759 stmt_list = lappend (stmt_list , stmt );
777760 }
778761
779- if (snapshot_set )
780- PopActiveSnapshot ();
781-
782762 return stmt_list ;
783763}
784764
@@ -937,7 +917,7 @@ exec_simple_query(const char *query_string)
937917 querytree_list = pg_analyze_and_rewrite (parsetree , query_string ,
938918 NULL , 0 );
939919
940- plantree_list = pg_plan_queries (querytree_list , 0 , NULL , false );
920+ plantree_list = pg_plan_queries (querytree_list , 0 , NULL );
941921
942922 /* Done with the snapshot used for parsing/planning */
943923 if (snapshot_set )
@@ -1276,7 +1256,7 @@ exec_parse_message(const char *query_string, /* string to execute */
12761256 }
12771257 else
12781258 {
1279- stmt_list = pg_plan_queries (querytree_list , 0 , NULL , false );
1259+ stmt_list = pg_plan_queries (querytree_list , 0 , NULL );
12801260 fully_planned = true;
12811261 }
12821262
@@ -1725,7 +1705,7 @@ exec_bind_message(StringInfo input_message)
17251705 */
17261706 oldContext = MemoryContextSwitchTo (PortalGetHeapMemory (portal ));
17271707 query_list = copyObject (cplan -> stmt_list );
1728- plan_list = pg_plan_queries (query_list , 0 , params , false );
1708+ plan_list = pg_plan_queries (query_list , 0 , params );
17291709 MemoryContextSwitchTo (oldContext );
17301710
17311711 /* We no longer need the cached plan refcount ... */
0 commit comments