Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-17 Thread Alexander Pyhalov
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: coul

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-18 Thread Richard Guo
On Mon, Jun 17, 2024 at 10:51 PM Alexander Pyhalov wrote: > 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

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-18 Thread Tom Lane
Richard Guo writes: > On Mon, Jun 17, 2024 at 10:51 PM Alexander Pyhalov > 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 proce

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-19 Thread Richard Guo
On Wed, Jun 19, 2024 at 12:49 PM Tom Lane wrote: > Richard Guo writes: > > 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 va

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-19 Thread Alexander Pyhalov
Richard Guo писал(а) 2024-06-19 16:30: On Wed, Jun 19, 2024 at 12:49 PM Tom Lane wrote: Richard Guo writes: > 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

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-06-23 Thread Richard Guo
On Wed, Jun 19, 2024 at 10:24 PM Alexander Pyhalov wrote: > Richard Guo писал(а) 2024-06-19 16:30: > > I think we can simply verify the validity of commutators for clauses in > > the form "inner op outer" when selecting mergejoin/hash clauses. If a > > clause lacks a commutator, we should conside

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-07-24 Thread Tom Lane
Richard Guo writes: > Thank you for confirming. Here is an updated patch with some tweaks to > the comments and commit message. I've parked this patch in the July > commitfest. I took a brief look at this. I think the basic idea is sound, but I have a couple of nits: * It's not entirely obvio

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-07-26 Thread Richard Guo
On Thu, Jul 25, 2024 at 12:07 AM Tom Lane wrote: > I took a brief look at this. I think the basic idea is sound, > but I have a couple of nits: Thank you for reviewing this patch! > * It's not entirely obvious that the checks preceding these additions > are sufficient to ensure that the clauses

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-09-03 Thread Richard Guo
On Fri, Jul 26, 2024 at 3:56 PM Richard Guo wrote: > Do you think it works if we place this test in equivclass.sql and > write a comment explaining why it's there, like attached? Now I’m > also starting to wonder if this change actually warrants such a test. The new test case fails starting from

Re: Inconsistency between try_mergejoin_path and create_mergejoin_plan

2024-09-03 Thread Richard Guo
On Tue, Sep 3, 2024 at 5:51 PM Richard Guo wrote: > The new test case fails starting from adf97c156, and we have to > install a hash opfamily and a hash function for the hacked int8alias1 > type to make the test case work again. > > Now, I'm more dubious about whether we really need to add a test