Re: [REVIEW] prepare plans of embedded sql on function start
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Andy Colson <andy@squeakycode.net>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2011-10-05T12:33:29Z
Lists: pgsql-hackers
Attachments
- check_function.diff (text/x-patch) patch
Hello
this is initial version of CHECK FUNCTION | CHECK TRIGGER statement
usage is simple
postgres=# CHECK FUNCTION f();
CHECK FUNCTION
Time: 3,411 ms
postgres=# CHECK TRIGGER foo ON omega ;
NOTICE: checking function "trg()"
CHECK TRIGGER
Time: 73,139 ms
postgres=# select plpgsql_checker('f()'::regprocedure, 0);
plpgsql_checker
─────────────────
(1 row)
Time: 0,861 ms
second parameter of plpgsql_checker function is relation oid that is
used for trigger checking. A possibility batch checking is reason why
I used new PL function.
when function has a bug, then CHECK FUNCTION show it
postgres=# CHECK FUNCTION fx();
ERROR: column "z" does not exist
LINE 1: SELECT exists(select * from omega where z = 1)
^
QUERY: SELECT exists(select * from omega where z = 1)
CONTEXT: PL/pgSQL function "fx" line 4 at IF
postgres=#
autocomplete in psql is supported
Regards
Pavel Stehule