mirror of
https://github.com/HypoPG/hypopg
synced 2026-05-23 09:08:45 +00:00
This will fail on pg10- servers, but since hypothetical partitioning has some feature not covered by regression tests, a full coverage of hypopg for all pg versions will be done in other commit(s).
18 lines
350 B
PL/PgSQL
18 lines
350 B
PL/PgSQL
-- General setup
|
|
|
|
-- Create extension
|
|
CREATE EXTENSION hypopg;
|
|
|
|
-- Create do_explain function
|
|
CREATE OR REPLACE FUNCTION do_explain(stmt text) RETURNS table(a text) AS
|
|
$_$
|
|
DECLARE
|
|
ret text;
|
|
BEGIN
|
|
FOR ret IN EXECUTE format('EXPLAIN (FORMAT text) %s', stmt) LOOP
|
|
a := ret;
|
|
RETURN next ;
|
|
END LOOP;
|
|
END;
|
|
$_$
|
|
LANGUAGE plpgsql;
|