Inconsistency between try_mergejoin_path and create_mergejoin_plan

From: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Inconsistency between try_mergejoin_path and create_mergejoin_plan
Date: 2024-06-17 14:51:30
Message-ID: c59ec04a2fef94d9ffc35a9b17dfc081@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

There's the following inconsistency between try_mergejoin_path() and
create_mergejoin_plan().
When clause operator has no commutator, we can end up with mergejoin
path.
Later create_mergejoin_plan() will call get_switched_clauses(). This
function can error out with

ERROR: could not find commutator for operator XXX

The similar behavior seems to be present also for hash join.

Attaching a test case (in patch) and a possible fix.

--
Best regards,
Alexander Pyhalov,
Postgres Professional

Attachment Content-Type Size
0001-Merge-and-hash-joins-need-more-checks-with-custom-op.patch text/x-diff 5.8 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-06-17 14:53:27 Re: Show WAL write and fsync stats in pg_stat_io
Previous Message Jacob Champion 2024-06-17 14:11:06 Re: Direct SSL connection and ALPN loose ends