postgresql/src/include/nodes
Tom Lane 29aa0ce361 Fix planner error with multiple copies of an AlternativeSubPlan.
It's possible for us to copy an AlternativeSubPlan expression node
into multiple places, for example the scan quals of several
partition children.  Then it's possible that we choose a different
one of the alternatives as optimal in each place.  Commit 41efb8340
failed to consider this scenario, so its attempt to remove "unused"
subplans could remove subplans that were still used elsewhere.

Fix by delaying the removal logic until we've examined all the
AlternativeSubPlans in a given query level.  (This does assume that
AlternativeSubPlans couldn't get copied to other query levels, but
for the foreseeable future that's fine; cf qual_is_pushdown_safe.)

Per report from Rajkumar Raghuwanshi.  Back-patch to v14
where the faulty logic came in.

Discussion: https://postgr.es/m/CAKcux6==O3NNZC3bZ2prRYv3cjm3_Zw1GfzmOjEVqYN4jub2+Q@mail.gmail.com
2021-09-14 15:11:21 -04:00
..
bitmapset.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
execnodes.h Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
extensible.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
lockoptions.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
makefuncs.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
memnodes.h Add function to log the memory contexts of specified backend process. 2021-04-06 13:44:15 +09:00
nodeFuncs.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes.h Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
params.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
parsenodes.h Avoid trying to lock OLD/NEW in a rule with FOR UPDATE. 2021-08-19 12:12:35 -04:00
pathnodes.h Fix planner error with multiple copies of an AlternativeSubPlan. 2021-09-14 15:11:21 -04:00
pg_list.h Implement GROUP BY DISTINCT 2021-03-18 18:22:18 +01:00
plannodes.h Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
primnodes.h Speedup ScalarArrayOpExpr evaluation 2021-04-08 23:51:22 +12:00
print.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
readfuncs.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
replnodes.h Remove two_phase variable from CreateReplicationSlotCmd struct. 2021-06-07 09:32:06 +05:30
subscripting.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
supportnodes.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
tidbitmap.h Update copyright for 2021 2021-01-02 13:06:25 -05:00
value.h Update copyright for 2021 2021-01-02 13:06:25 -05:00