Re: Allowing extensions to supply operator-/function-specific info - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allowing extensions to supply operator-/function-specific info
Date
Msg-id 24446.1551828396@sss.pgh.pa.us
Whole thread Raw
In response to Re: Allowing extensions to supply operator-/function-specific info  (Paul Ramsey <pramsey@cleverelephant.ca>)
Responses Re: Allowing extensions to supply operator-/function-specific info
List pgsql-hackers
Paul Ramsey <pramsey@cleverelephant.ca> writes:
> Thanks for the patch, I’ve applied and smoothed and taken your advice on schema-qualified lookups as well.

Hm, I think your addition of this bit is wrong:

+                    /*
+                    * Arguments were swapped to put the index value on the
+                    * left, so we need the commutated operator for
+                    * the OpExpr
+                    */
+                    if (swapped)
+                    {
+                        oproid = get_commutator(oproid);
+                        if (!OidIsValid(oproid))
                         PG_RETURN_POINTER((Node *)NULL);
+                    }

We already did the operator lookup with the argument types in the desired
order, so this is introducing an extra swap.  The only reason it appears
to work, I suspect, is that all your index operators are self-commutators.

            regards, tom lane


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: NOT IN subquery optimization
Next
From: Paul Ramsey
Date:
Subject: Re: Allowing extensions to supply operator-/function-specific info