Re: poll: CHECK TRIGGER?

From: Petr Jelinek <pjmodos(at)pjmodos(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: poll: CHECK TRIGGER?
Date: 2012-03-08 11:30:14
Message-ID: 4F589846.70303@pjmodos.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
reduced_pl_checker_2012-03-08_3.patch.gz application/gzip 28.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2012-03-08 12:06:02 check function patch
Previous Message Thom Brown 2012-03-08 11:06:24 Re: pg_basebackup streaming issue from standby