diff options
| author | Tom Lane | 2007-10-11 18:05:27 +0000 |
|---|---|---|
| committer | Tom Lane | 2007-10-11 18:05:27 +0000 |
| commit | 82d8ab6fc4c1a0330c91022728e1e766db207069 (patch) | |
| tree | 0bd9635d34da6c964d37fd4a725ead26a9a7340d /src/backend/nodes | |
| parent | 68b08b251239e9ec883156b0cba53316c88adb5f (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/backend/nodes')
| -rw-r--r-- | src/backend/nodes/copyfuncs.c | 3 | ||||
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index b6c6331d170..c6393effcd6 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.382 2007/09/03 18:46:30 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.383 2007/10/11 18:05:26 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -83,6 +83,7 @@ _copyPlannedStmt(PlannedStmt *from) COPY_BITMAPSET_FIELD(rewindPlanIDs); COPY_NODE_FIELD(returningLists); COPY_NODE_FIELD(rowMarks); + COPY_NODE_FIELD(relationOids); COPY_SCALAR_FIELD(nParamExec); return newnode; diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index db0bf7c050d..005879b8c91 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.314 2007/08/31 01:44:05 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.315 2007/10/11 18:05:27 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -250,6 +250,7 @@ _outPlannedStmt(StringInfo str, PlannedStmt *node) WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(returningLists); WRITE_NODE_FIELD(rowMarks); + WRITE_NODE_FIELD(relationOids); WRITE_INT_FIELD(nParamExec); } @@ -1300,6 +1301,7 @@ _outPlannerGlobal(StringInfo str, PlannerGlobal *node) WRITE_NODE_FIELD(subrtables); WRITE_BITMAPSET_FIELD(rewindPlanIDs); WRITE_NODE_FIELD(finalrtable); + WRITE_NODE_FIELD(relationOids); } static void |
