Cristiano Duarte wrote:
2007/9/17, Tom Lane <[EMAIL PROTECTED]>:
"Cristiano Duarte" <[EMAIL PROTECTED]> writes:
Is there a way to have access to PostgreSQL query plan and/or predicates inside a function using spi (or any other way)?
No.

Hi Tom,

"No" means: there is no way since the query plan is stored in a secret/safe/protected/non-visible/fort-knox like place :) or it means, there
is no friendly way to do it with spi or casual c language programming?

"No" as in: You function is not told by the executor which filters are applied
to it's results, and since it might be called multiple times within a query you
cannot figure that out yourself, even if you somehow got hold of the currently
executed plan.

So unless you start to hack the executor in serious ways, you'll either have to
pass the filter condition manually to your function, or live with it producing
unnecessary output rows.

Thats only holds true for functions in languages other than pl/sql (Which is
*not* the same as pl/pgsql) - SQL functions can be inlined by the executor, and
then are subject to the usual optimizations. (So they essentially behave like
views).

greetings, Florian Pflug


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to