Tender Wang <[email protected]> writes:
> Tom Lane <[email protected]> 于2026年10月15日周四 04:56写道:
>> If we're going to refuse that, I wonder if we couldn't simplify
>> match_unique_clauses a great deal: just insist that the two OpExpr
>> clauses be equal(), after the ChangeVarNodes substitution on the outer
>> clause.  Your proposal already breaks commuted-clause cases, which
>> seem like the only justification for all the futzing around with left
>> and right operands.  I doubt that detecting that is of any real-world
>> value anyway.

> Attached is v2, following your suggestion to compare the complete
> clauses with equal() after the ChangeVarNodes substitution. I also
> removed the test added in v1.

LGTM, pushed.

> I ran the regression tests and found no plan differences. This
> suggests the existing tests don't cover cases where matching commuted
> restrictions enables self-join elimination.

Yeah, that's evidence in favor of my opinion that this wasn't worth
the complexity.  If somebody wanted to put that back, we could try
building a commuted clause (cf. CommuteOpExpr) and applying equal()
with that.  But I really doubt it's worth the code and cycles.

                        regards, tom lane


Reply via email to