pgsql: Fix thinko in qual distribution.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix thinko in qual distribution.
Date: 2023-02-04 22:40:43
Message-ID: E1pORD8-001cUE-HR@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix thinko in qual distribution.

deconstruct_distribute tweaks the outer join scope (ojscope)
it passes to distribute_qual_to_rels when considering an outer
join qual that's above potentially-commutable outer joins.
However, if the current join is *not* potentially commutable,
we shouldn't do that. The argument that distribute_qual_to_rels
will not do something wrong with the bogus ojscope falls flat
if we don't pass it non-null postponed_oj_qual_list. Moreover,
there's no need to play games in this case since we aren't going
to commute anything.

Per SQLSmith testing by Robins Tharakan.

Discussion: https://postgr.es/m/CAEP4nAw74k4b-=93gmfCNX3MOY3y4uPxqbk_MnCVEpdsqHJVsg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9f452feeeb830534dc2ce743a2a14b109128326d

Modified Files
--------------
src/backend/optimizer/plan/initsplan.c | 29 ++++++++++++++---------------
src/test/regress/expected/join.out | 18 ++++++++++++++++++
src/test/regress/sql/join.sql | 10 ++++++++++
3 files changed, 42 insertions(+), 15 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2023-02-05 19:25:25 pgsql: Fix over-optimistic updating of info about commutable outer join
Previous Message Tom Lane 2023-02-04 20:20:07 pgsql: Fix thinko in outer-join removal.