summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2007-10-11 18:05:27 +0000
committerTom Lane2007-10-11 18:05:27 +0000
commit82d8ab6fc4c1a0330c91022728e1e766db207069 (patch)
tree0bd9635d34da6c964d37fd4a725ead26a9a7340d /src/include
parent68b08b251239e9ec883156b0cba53316c88adb5f (diff)
Fix the plan-invalidation mechanism to treat regclass constants that refer to
a relation as a reason to invalidate a plan when the relation changes. This handles scenarios such as dropping/recreating a sequence that is referenced by nextval('seq') in a cached plan. Rather than teach plancache.c all about digging through plan trees to find regclass Consts, we charge the planner's setrefs.c with making a list of the relation OIDs on which each plan depends. That way the list can be built cheaply during a plan tree traversal that has to happen anyway. Per bug #3662 and subsequent discussion.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/plannodes.h4
-rw-r--r--src/include/nodes/relation.h4
-rw-r--r--src/include/optimizer/planmain.h5
3 files changed, 9 insertions, 4 deletions
diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h
index 992b47f58d8..9b6c6372846 100644
--- a/src/include/nodes/plannodes.h
+++ b/src/include/nodes/plannodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.95 2007/09/20 17:56:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.96 2007/10/11 18:05:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,6 +70,8 @@ typedef struct PlannedStmt
List *rowMarks; /* a list of RowMarkClause's */
+ List *relationOids; /* OIDs of relations the plan depends on */
+
int nParamExec; /* number of PARAM_EXEC Params used */
} PlannedStmt;
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 32c699b6de6..38903520222 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.146 2007/09/20 17:56:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.147 2007/10/11 18:05:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,6 +72,8 @@ typedef struct PlannerGlobal
List *finalrtable; /* "flat" rangetable for executor */
+ List *relationOids; /* OIDs of relations the plan depends on */
+
bool transientPlan; /* redo plan when TransactionXmin changes? */
} PlannerGlobal;
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 4673d53098f..43769c71e11 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.102 2007/10/04 20:44:47 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.103 2007/10/11 18:05:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -96,7 +96,8 @@ extern RestrictInfo *build_implied_join_equality(Oid opno,
extern Plan *set_plan_references(PlannerGlobal *glob,
Plan *plan,
List *rtable);
-extern List *set_returning_clause_references(List *rlist,
+extern List *set_returning_clause_references(PlannerGlobal *glob,
+ List *rlist,
Plan *topplan,
Index resultRelation);
extern void fix_opfuncids(Node *node);