getting EXPLAIN output from inside a function

Lists: pgsql-general
From: Joseph S <jks(at)selectacast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: getting EXPLAIN output from inside a function
Date: 2011-04-21 18:41:06
Message-ID: iopto2$1dc9$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

I saw this in the mailing list archives without an answer, so for future
reference:

DECLARE
...
line TEXT;
BEGIN
...
FOR line IN EXECUTE ''EXPLAIN ANALYZE <statement goes here> LOOP
RAISE NOTICE ''% '' , line;
END LOOP;