Re: Allowing extensions to supply operator-/function-specific info

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Paul Ramsey <pramsey(at)cleverelephant(dot)ca>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allowing extensions to supply operator-/function-specific info
Date: 2019-03-05 23:26:36
Message-ID: 24446.1551828396@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Paul Ramsey <pramsey(at)cleverelephant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Ramsey 2019-03-05 23:38:12 Re: Allowing extensions to supply operator-/function-specific info
Previous Message David Rowley 2019-03-05 23:25:46 Re: NOT IN subquery optimization