Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb69bde7

Browse files
committed
Remove pg_plan_queries()'s now-useless needSnapshot parameter. It's useless
in 8.3, too, but I'm not back-patching this change since it would break anyextension modules that might be calling that function.
1 parentc98a923 commitb69bde7

File tree

5 files changed

+15
-37
lines changed

5 files changed

+15
-37
lines changed

‎src/backend/commands/prepare.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Copyright (c) 2002-2008, PostgreSQL Global Development Group
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.92 2008/10/29 00:00:38 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.93 2008/12/13 02:29:21 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -144,8 +144,8 @@ PrepareQuery(PrepareStmt *stmt, const char *queryString)
144144
/* Rewrite the query. The result could be 0, 1, or many queries. */
145145
query_list=QueryRewrite(query);
146146

147-
/* Generate plans for queries.Snapshot is already set. */
148-
plan_list=pg_plan_queries(query_list,0,NULL, false);
147+
/* Generate plans for queries. */
148+
plan_list=pg_plan_queries(query_list,0,NULL);
149149

150150
/*
151151
* Save the results.

‎src/backend/executor/spi.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.201 2008/11/30 20:51:25 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.202 2008/12/13 02:29:21 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1606,8 +1606,7 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan, ParamListInfo boundParams)
16061606
/* Need a copyObject here to keep parser from modifying raw tree */
16071607
stmt_list=pg_analyze_and_rewrite(copyObject(parsetree),
16081608
src,argtypes,nargs);
1609-
stmt_list=pg_plan_queries(stmt_list,cursor_options,
1610-
boundParams, false);
1609+
stmt_list=pg_plan_queries(stmt_list,cursor_options,boundParams);
16111610

16121611
plansource= (CachedPlanSource*)palloc0(sizeof(CachedPlanSource));
16131612
cplan= (CachedPlan*)palloc0(sizeof(CachedPlan));

‎src/backend/tcop/postgres.c

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
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
*/
746738
List*
747-
pg_plan_queries(List*querytrees,intcursorOptions,ParamListInfoboundParams,
748-
boolneedSnapshot)
739+
pg_plan_queries(List*querytrees,intcursorOptions,ParamListInfoboundParams)
749740
{
750741
List*stmt_list=NIL;
751742
ListCell*query_list;
752-
boolsnapshot_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
returnstmt_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 ... */

‎src/backend/utils/cache/plancache.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Portions Copyright (c) 1994, Regents of the University of California
3636
*
3737
* IDENTIFICATION
38-
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.24 2008/12/13 02:00:20 tgl Exp $
38+
* $PostgreSQL: pgsql/src/backend/utils/cache/plancache.c,v 1.25 2008/12/13 02:29:22 tgl Exp $
3939
*
4040
*-------------------------------------------------------------------------
4141
*/
@@ -503,8 +503,7 @@ RevalidateCachedPlan(CachedPlanSource *plansource, bool useResOwner)
503503
/*
504504
* Generate plans for queries.
505505
*/
506-
slist=pg_plan_queries(slist,plansource->cursor_options,
507-
NULL, false);
506+
slist=pg_plan_queries(slist,plansource->cursor_options,NULL);
508507
}
509508

510509
/*

‎src/include/tcop/tcopprot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.95 2008/12/09 15:59:39 heikki Exp $
10+
* $PostgreSQL: pgsql/src/include/tcop/tcopprot.h,v 1.96 2008/12/13 02:29:22 tgl Exp $
1111
*
1212
* OLD COMMENTS
1313
* This file was created so that other c files could get the two
@@ -52,7 +52,7 @@ extern List *pg_analyze_and_rewrite(Node *parsetree, const char *query_string,
5252
externPlannedStmt*pg_plan_query(Query*querytree,intcursorOptions,
5353
ParamListInfoboundParams);
5454
externList*pg_plan_queries(List*querytrees,intcursorOptions,
55-
ParamListInfoboundParams,boolneedSnapshot);
55+
ParamListInfoboundParams);
5656

5757
externboolassign_max_stack_depth(intnewval,booldoit,GucSourcesource);
5858

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp