Re: return text from explain

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

cool, it does work with RETURN QUERY.

Thanx!

WBL

On Fri, Sep 7, 2012 at 11:00 AM, Виктор Егоров <vyegorov(at)gmail(dot)com> 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2012-09-07 14:58:30 Re: Multiple indexes, huge table
Previous Message Виктор Егоров 2012-09-07 09:00:14 Re: return text from explain