Re: return text from explain

From: Виктор Егоров <vyegorov(at)gmail(dot)com>
To: Willy-Bas Loos <willybas(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: return text from explain
Date: 2012-09-07 09:00:14
Message-ID: CAGnEbojor497XDE6PLpvasZFDsxJ_Sj5KHO0-UhjxuUCAnkg6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hope this helps:

CREATE OR REPLACE FUNCTION explain(in_sql text) RETURNS TABLE(explain_line
text) AS $explain$
BEGIN
RETURN QUERY EXECUTE 'EXPLAIN '||in_sql;
END;
$explain$ LANGUAGE plpgsql;

SELECT * FROM explain('SELECT * FROM pg_locks');

--
Victor Y. Yegorov

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2012-09-07 09:10:06 Re: return text from explain
Previous Message Willy-Bas Loos 2012-09-07 08:40:34 Re: return text from explain