Fix caching of foreign-key-checking queries so that when a replan is needed,
Tom Lane <tgl@sss.pgh.pa.us>
Fix caching of foreign-key-checking queries so that when a replan is needed, we regenerate the SQL query text not merely the plan derived from it. This is needed to handle contingencies such as renaming of a table or column used in an FK. Pre-8.3, such cases worked despite the lack of replanning (because the cached plan needn't actually change), so this is a regression. Per bug #4417 from Benjamin Bihler.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/executor/spi.c | modified | +31 −1 |
| src/backend/utils/adt/ri_triggers.c | modified | +29 −3 |
| src/backend/utils/cache/plancache.c | modified | +39 −1 |
| src/include/executor/spi.h | modified | +2 −1 |
| src/include/utils/plancache.h | modified | +2 −1 |