postgresql/src/backend
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
..
access Further portability tweaks for float4/float8 hash functions. 2021-09-04 16:29:08 -04:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog Invalidate relcache for publications defined for all tables. 2021-09-08 12:08:29 +05:30
commands Fix some anomalies with NO SCROLL cursors. 2021-09-10 13:18:32 -04:00
executor Fix missing words in comment. 2021-09-07 10:30:04 +03:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit jit: Do not try to shut down LLVM state in case of LLVM triggered errors. 2021-09-13 18:15:28 -07:00
lib Fix typo in comment 2021-04-20 14:35:16 +02:00
libpq Set type identifier on BIO 2021-08-17 14:30:25 +02:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Change the name of the Result Cache node to Memoize 2021-07-14 12:45:00 +12:00
optimizer Fix planner error with multiple copies of an AlternativeSubPlan. 2021-09-14 15:11:21 -04:00
parser Disable anonymous record hash support except in special cases 2021-09-08 09:55:18 +02:00
partitioning Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:21:35 +09:00
po Translation updates 2021-08-09 11:51:59 +02:00
port Make EXEC_BACKEND more convenient on macOS. 2021-08-13 11:11:59 +12:00
postmaster Consistently use read-only instead of "read only" 2021-09-07 22:04:45 +02:00
regex Make pg_regexec() robust against out-of-range search_start. 2021-09-11 15:19:43 -04:00
replication Fix reorder buffer memory accounting for toast changes. 2021-09-13 10:35:00 +05:30
rewrite Fix rewriter to set hasModifyingCTE correctly on rewritten queries. 2021-09-08 12:05:43 -04:00
snowball Update snowball 2021-02-19 08:10:15 +01:00
statistics Error message refactoring 2021-06-27 09:41:16 +02:00
storage Fix potential for compiler warning in GlobalVisTestFor(). 2021-09-13 16:50:10 -07:00
tcop Fix some anomalies with NO SCROLL cursors. 2021-09-10 13:18:32 -04:00
tsearch Fix typos and grammar in comments and docs 2021-04-19 11:32:30 +09:00
utils Disable anonymous record hash support except in special cases 2021-09-08 09:55:18 +02:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Translation updates 2021-05-10 14:36:21 +02:00