Project

General

Profile

« Previous | Next » 

Revision 14231

schemas/util.sql: explain(): support running in verbose mode

View differences:

trunk/schemas/util.sql
2531 2531

  
2532 2532

  
2533 2533
--
2534
-- Name: explain(text); Type: FUNCTION; Schema: util; Owner: -
2534
-- Name: explain(text, boolean); Type: FUNCTION; Schema: util; Owner: -
2535 2535
--
2536 2536

  
2537
CREATE FUNCTION explain(sql text) RETURNS SETOF text
2537
CREATE FUNCTION explain(sql text, verbose_ boolean DEFAULT false) RETURNS SETOF text
2538 2538
    LANGUAGE sql
2539 2539
    SET client_min_messages TO 'error'
2540 2540
    AS $_$
2541 2541
/* `client_min_messages = ERROR`: EXPLAIN apparently runs IMMUTABLE functions in
2542 2542
the query, so this prevents displaying any log messages printed by them */
2543
SELECT util.eval2set($$EXPLAIN $$||$1, verbose_ := false)
2543
SELECT util.eval2set($$EXPLAIN $$||$1, verbose_ := verbose_)
2544 2544
$_$;
2545 2545

  
2546 2546

  

Also available in: Unified diff