Search Postgresql Archives

Re: return text from explain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cool, it does work with RETURN QUERY.

Thanx!

WBL

On Fri, Sep 7, 2012 at 11:00 AM, Виктор Егоров <vyegorov@xxxxxxxxx> wrote:
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



--
"Quality comes from focus and clarity of purpose" -- Mark Shuttleworth


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux