Re: More WITH - Mailing list pgsql-hackers

From David Fetter
Subject Re: More WITH
Date
Msg-id 20150817173752.GC32300@fetter.org
Whole thread Raw
In response to Re: More WITH  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On Mon, Aug 17, 2015 at 10:22:11AM -0700, Josh Berkus wrote:
> 
> > EXPLAIN [ANALYZE]
> 
> Would be tricky.  We don't currently have any way to wrap an EXPLAIN
> in any larger statement, do we?

We do, but it's kinda horrible.

CREATE OR REPLACE FUNCTION get_something_from_explain(your_query)
RETURNS TEXT
LANGUAGE plpgsql /* uh oh */
AS $$
DECLARE   foo JSON;
BEGIN   EXECUTE format('EXPLAIN (FORMAT json), your_query) INTO foo;   RETURN foo #>> '{bar,baz,quux}';
END;
$$;

> Would be very useful for automated query analysis, though.

Among many other things, certainly :)

> > SHOW
> 
> Not very useful, easy to work around (pg_settings).

This particular one is just about being consistent, or the way I look
at it, about avoiding surprising users with inconsistencies.

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Configure with thread sanitizer fails the thread test
Next
From: Andres Freund
Date:
Subject: Re: Configure with thread sanitizer fails the thread test