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

From Paul Ramsey
Subject Re: Allowing extensions to supply operator-/function-specific info
Date
Msg-id 91BAE1F4-7C16-4F87-849F-B01175A8D7D8@cleverelephant.ca
Whole thread Raw
In response to Re: Allowing extensions to supply operator-/function-specific info  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Allowing extensions to supply operator-/function-specific info  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> On Feb 26, 2019, at 2:19 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> In most cases, multiple matching arguments are going to lead to
> failure to construct any useful index condition, because your
> comparison value has to be a pseudoconstant (ie, not a variable
> from the same table, so in both of the above examples there's
> no function argument you could compare to).

This term “pseudoconstant” has been causing me some worry as it crops up in your explanations a fair amount. I expect
tohave queries of the form 

  SELECT a.*, b.*
  FROM a
  JOIN b
  ON ST_Intersects(a.geom, b.geom)

And I expect to be able to rewrite that in terms of having an additional call to the index operator (&&) and there
won’tbe a constant on either side of the operator. Am I mis-understanding the term, or are there issues with using this
APIin a join context? 

P.

> But we don't prejudge
> that, because it's possible that a function with 3 or more arguments
> could produce something useful anyway.  For instance, if what we've
> got is "f(x, y, constant)" then it's possible that the semantics of
> the function are such that y can be ignored and we can make something
> indexable like "x && constant".  All this is the support function's
> job to know.

>             regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Segfault when restoring -Fd dump on current HEAD
Next
From: "Li, Zheng"
Date:
Subject: Re: NOT IN subquery optimization