Fix handling of changed-Param signaling for CteScan plan nodes. We were using
commitc312fe6d3a87d9bfaa0ef39cb1e1fccbd1c0fbf5
authortgl <tgl>
Mon, 6 Jul 2009 02:16:03 +0000 (6 02:16 +0000)
committertgl <tgl>
Mon, 6 Jul 2009 02:16:03 +0000 (6 02:16 +0000)
tree3730679352189c11285ca36fb41217af2b4464bf
parent4b11cbf74b33b9c57edaa14fa07dbf672adc035a
Fix handling of changed-Param signaling for CteScan plan nodes.  We were using
the "cteParam" as a proxy for the possibility that the underlying CTE plan
depends on outer-level variables or Params, but that doesn't work very well
because it sometimes causes calling subqueries to be treated as SubPlans when
they could be InitPlans.  This is inefficient and also causes the outright
failure exhibited in bug #4902.  Instead, leave the cteParam out of it and
copy the underlying CTE plan's extParams directly.  Per bug #4902 from
Marko Tiikkaja.
src/backend/optimizer/plan/subselect.c
src/test/regress/expected/with.out
src/test/regress/sql/with.sql