From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | David Fetter <david(at)fetter(dot)org>, "Ed L(dot)" <pgsql(at)bluepolka(dot)net>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Understanding EXPLAIN ANALYZE output |
Date: | 2005-02-10 04:36:22 |
Message-ID: | 22773.1108010182@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Michael Fuhr <mike(at)fuhr(dot)org> writes:
> I started looking at this earlier. Is it even possible to get
> EXPLAIN output via SPI (and thus the PLs' interfaces to SPI)?
Hmm ... my first reaction was "sure", but:
regression=# create or replace function foo() returns setof text as $$
regression$# declare x record;
regression$# begin
regression$# for x in explain select * from tenk1 where unique1 = 42
regression$# loop
regression$# return next x."QUERY PLAN";
regression$# end loop;
regression$# return;
regression$# end$$ language plpgsql;
CREATE FUNCTION
regression=# select * from foo();
ERROR: cannot open non-SELECT query as cursor
CONTEXT: PL/pgSQL function "foo" line 3 at for over select rows
(And no, EXECUTE doesn't help.) This seems like an oversight. We
already have some understanding in the backend that certain utility
commands return query results; the SPI code should be letting those
results be scanned as if they were ordinary SELECT results.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-02-10 05:01:41 | Re: a SELECT FOR UPDATE question |
Previous Message | Oisin Glynn | 2005-02-10 04:28:12 | Re: Functions with more than 32 parameters |