Re: poll: CHECK TRIGGER?

Petr Jelinek <pjmodos@pjmodos.net>

From: Petr Jelinek <pjmodos@pjmodos.net>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>, Alvaro Herrera <alvherre@commandprompt.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2012-03-08T11:30:14Z
Lists: pgsql-hackers

Attachments

On 03/08/2012 08:35 AM, Pavel Stehule wrote:
> Here is updated patch (with regress tests, with documentation).
>
> I removed a CHECK FUNCTION and CHECK TRIGGER statements and replaced
> it by pg_check_function and pg_check_trigger like Tom proposed.
>
> The core of this patch is same - plpgsql checker, only user interface
> was reduced.
>
> postgres=>  select pg_check_function('f2()');
>                         pg_check_function
> ---------------------------------------------------------------
>   error:42703:3:RETURN:column "missing_variable" does not exist
>   Query: SELECT 'Hello' || missing_variable
>   --                       ^
> (3 rows)
>
> postgres=>  select pg_check_trigger('t','t1');
>                      pg_check_trigger
> --------------------------------------------------------
>   error:42703:3:assignment:record "new" has no field "b"
>   Context: SQL statement "SELECT new.b + 1"
> (2 rows)
>

I did rereview and rechecked with few dozen of real-world functions, and 
it still looks good from my point of view. I made bit of adjustment of 
english in new comments and Pavel sent me privately fix for proper 
handling of languages that don't have checker function. Updated patch 
attached.

Regards
Petr Jelinek