Fix the plan-invalidation mechanism to treat regclass constants that refer to
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Oct 2007 18:05:27 +0000 (18:05 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Oct 2007 18:05:27 +0000 (18:05 +0000)
commit6311d8a18a440aab949e2ca931e40f384094feeb
treebf3f06e7a676b08cfbc6ed086d35bb62f28a6bda
parentbfde4b5e1b8ed915c6d634cf3af5fbf12091981f
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.
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/utils/cache/plancache.c
src/include/nodes/plannodes.h
src/include/nodes/relation.h
src/include/optimizer/planmain.h
src/test/regress/expected/plancache.out
src/test/regress/sql/plancache.sql