Re: return text from explain - Mailing list pgsql-general

From Виктор Егоров
Subject Re: return text from explain
Date
Msg-id CAGnEbojor497XDE6PLpvasZFDsxJ_Sj5KHO0-UhjxuUCAnkg6w@mail.gmail.com
Whole thread Raw
In response to Re: return text from explain  (Willy-Bas Loos <willybas@gmail.com>)
Responses Re: return text from explain  (Willy-Bas Loos <willybas@gmail.com>)
List 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

pgsql-general by date:

Previous
From: Willy-Bas Loos
Date:
Subject: Re: return text from explain
Next
From: Willy-Bas Loos
Date:
Subject: Re: return text from explain