Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan
Date: 2024-06-19 04:49:51
Message-ID: 48732.1718772591@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> On Mon, Jun 17, 2024 at 10:51 PM Alexander Pyhalov
> <a(dot)pyhalov(at)postgrespro(dot)ru> wrote:
>> ERROR: could not find commutator for operator XXX

> It seems to me that the new operator is somewhat artificial, since it is
> designed to support a mergejoin but lacks a valid commutator. So before
> we proceed to discuss the fix, I'd like to know whether this is a valid
> issue that needs fixing.

Well, there's no doubt that the case is artificial: nobody who knew
what they were doing would install an incomplete opclass like this
in a production setting. However, there are several parts of the
planner that take pains to avoid this type of failure. I am pretty
sure that we are careful about flipping around candidate indexscan
quals for instance. And the "broken equivalence class" mechanism
is all about that, which is what equivclass.sql is setting up this
opclass to test. So I find it a bit sad if mergejoin creation is
tripping over this case.

I do not think we should add a great deal of complexity or extra
planner cycles to deal with this; but if it can be fixed at low
cost, we should.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-06-19 05:14:50 RE: 001_rep_changes.pl fails due to publisher stuck on shutdown
Previous Message Amit Kapila 2024-06-19 04:21:05 Re: DOCS: Generated table columns are skipped by logical replication