pgsql: Fix the plan-invalidation mechanism to treat regclass constants

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix the plan-invalidation mechanism to treat regclass constants
Date: 2007-10-11 18:05:27
Message-ID: 20071011180527.A314A753E4C@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Modified Files:
--------------
pgsql/src/backend/nodes:
copyfuncs.c (r1.382 -> r1.383)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/copyfuncs.c?r1=1.382&r2=1.383)
outfuncs.c (r1.314 -> r1.315)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/nodes/outfuncs.c?r1=1.314&r2=1.315)
pgsql/src/backend/optimizer/plan:
planner.c (r1.222 -> r1.223)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planner.c?r1=1.222&r2=1.223)
setrefs.c (r1.136 -> r1.137)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/setrefs.c?r1=1.136&r2=1.137)
pgsql/src/backend/utils/cache:
plancache.c (r1.11 -> r1.12)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/plancache.c?r1=1.11&r2=1.12)
pgsql/src/include/nodes:
plannodes.h (r1.95 -> r1.96)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/plannodes.h?r1=1.95&r2=1.96)
relation.h (r1.146 -> r1.147)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/relation.h?r1=1.146&r2=1.147)
pgsql/src/include/optimizer:
planmain.h (r1.102 -> r1.103)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/planmain.h?r1=1.102&r2=1.103)
pgsql/src/test/regress/expected:
plancache.out (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/plancache.out?r1=1.4&r2=1.5)
pgsql/src/test/regress/sql:
plancache.sql (r1.4 -> r1.5)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/plancache.sql?r1=1.4&r2=1.5)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-10-11 18:19:58 pgsql: Remove incorrect use of VARSIZE() on a toasted datum.
Previous Message User Mkz 2007-10-11 12:03:51 plproxy - plproxy: experimantal server parameter syncing