[HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Cristiano Duarte
Hi, Is there a way to have access to PostgreSQL query plan and/or predicates inside a function using spi (or any other way)? For example: explain select * from my_func() as (code int, name varchar) where name like 'a%'; QUERY PLAN

Re: [HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Tom Lane
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. regards, tom lane ---(end of broadcast)--- TIP 2:

Re: [HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Cristiano Duarte
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

Re: [HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Florian G. Pflug
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

Re: [HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Michael Glaesemann
On Sep 17, 2007, at 19:46 , Florian G. Pflug wrote: 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

Re: [HACKERS] SPI access to PostgreSQL query plan

2007-09-17 Thread Tom Lane
Michael Glaesemann [EMAIL PROTECTED] writes: AIUI, the stress is on the *can*, with a meaning of may, right? Not all SQL functions can be inlined. In particular, I think the OP was thinking of a function returning set, which we currently don't inline at all. I believe this is doable, but