postgresql/src/backend/optimizer/util
Tom Lane 991a3df227 Fix filtering of "cloned" outer-join quals some more.
We've had multiple issues with the clause_is_computable_at logic that
I introduced in 2489d76c4: it's been known to accept more than one
clone of the same qual at the same plan node, and also to accept no
clones at all.  It's looking impractical to get it 100% right on the
basis of the currently-stored information, so fix it by introducing a
new RestrictInfo field "incompatible_relids" that explicitly shows
which outer joins a given clone mustn't be pushed above.

In principle we could populate this field in every RestrictInfo, but
that would cost space and there doesn't presently seem to be a need
for it in general.  Also, while deconstruct_distribute_oj_quals can
easily fill the field with the remaining members of the commutative
join set that it's considering, computing it in the general case
seems again pretty complicated.  So for now, just fill it for
clone quals.

Along the way, fix a bug that may or may not be only latent:
equivclass.c was generating replacement clauses with is_pushed_down
and has_clone/is_clone markings that didn't match their
required_relids.  This led me to conclude that leaving the clone flags
out of make_restrictinfo's purview wasn't such a great idea after all,
so add them.

Per report from Richard Guo.

Discussion: https://postgr.es/m/CAMbWs48EYi_9-pSd0ORes1kTmTeAjT4Q3gu49hJtYCbSn2JyeA@mail.gmail.com
2023-05-25 10:28:33 -04:00
..
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
appendinfo.c Pre-beta mechanical code beautification. 2023-05-19 17:24:48 -04:00
clauses.c Add back SQLValueFunction for SQL keywords 2023-05-17 10:19:17 +09:00
inherit.c Fix filtering of "cloned" outer-join quals some more. 2023-05-25 10:28:33 -04:00
joininfo.c Make Vars be outer-join-aware. 2023-01-30 13:16:20 -05:00
meson.build Update copyright for 2023 2023-01-02 15:00:37 -05:00
orclauses.c Fix filtering of "cloned" outer-join quals some more. 2023-05-25 10:28:33 -04:00
paramassign.c Update copyright for 2023 2023-01-02 15:00:37 -05:00
pathnode.c Fix parallel-safety marking when moving initplans to another node. 2023-04-12 10:46:38 -04:00
placeholder.c Remove local optimizations of empty Bitmapsets into null pointers. 2023-03-02 12:01:47 -05:00
plancat.c Fix some typos and some incorrectly duplicated words 2023-04-18 14:03:49 +12:00
predtest.c Remove useless casts to (void *) in hash_search() calls 2023-02-06 09:41:01 +01:00
relnode.c Fix filtering of "cloned" outer-join quals some more. 2023-05-25 10:28:33 -04:00
restrictinfo.c Fix filtering of "cloned" outer-join quals some more. 2023-05-25 10:28:33 -04:00
tlist.c Fix typos in comments, code and documentation 2023-01-03 16:26:14 +09:00
var.c Fix thinko in outer-join removal. 2023-02-04 15:19:54 -05:00