Re: review: CHECK FUNCTION statement

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
Cc: "Tom Lane *EXTERN*" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2011-12-07 07:23:32
Message-ID: CAFj8pRAmC5DMJB944NHUxg-+ocwqONOG6A4oMqPv26x33z=Zhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

there is a updated patch.

it support multi check, options and custom check functions are not
supported yet. I don't plan to implement custom check functions in
this round - I has not any example of usage - but we have agreement on
syntax and behave, so this should not be problem. I changed reporting
- from exception to warnings.

postgres=# check function all in schema public;
NOTICE: skip check function "hello()", it use C or internal language
NOTICE: skip check function "tri()", it is trigger function
NOTICE: skip check function "vloz_do_foo(integer)", language "sql"
hasn't checker function
NOTICE: skip check function "mojefunc(integer)", language "sql"
hasn't checker function
NOTICE: skip check function "myleft(text,integer)", language "sql"
hasn't checker function
NOTICE: checked function "array_random(integer,integer)"
NOTICE: skip check function "array_random1(integer,integer)",
language "sql" hasn't checker function
NOTICE: checked function "vrattab(integer)"
NOTICE: checked function "yyy()"
NOTICE: checked function "xxx()"
WARNING: error in function "zpracuj(integer)"
LINE 1: select h from hodnoty
^
DETAIL: column "h" does not exist
QUERY: select h from hodnoty
CONTEXT: line 4 at FOR over SELECT rows
WARNING: error in function "ii(integer)"
LINE 1: SELECT (select aa from i)
^
DETAIL: column "aa" does not exist
QUERY: SELECT (select aa from i)
CONTEXT: line 3 at RETURN
CHECK FUNCTION

postgres=# check function all in schema public in language plpgsql;
NOTICE: skip check function "tri()", it is trigger function
NOTICE: checked function "array_random(integer,integer)"
NOTICE: checked function "vrattab(integer)"
NOTICE: checked function "yyy()"
NOTICE: checked function "xxx()"
WARNING: error in function "zpracuj(integer)"
LINE 1: select h from hodnoty
^
DETAIL: column "h" does not exist
QUERY: select h from hodnoty
CONTEXT: line 4 at FOR over SELECT rows
WARNING: error in function "ii(integer)"
LINE 1: SELECT (select aa from i)
^
DETAIL: column "aa" does not exist
QUERY: SELECT (select aa from i)
CONTEXT: line 3 at RETURN
CHECK FUNCTION

postgres=# check function all in schema public in language plpgsql for role www;
NOTICE: nothing to check
CHECK FUNCTION

please, try it

Regards

Pavel Stehule

2011/12/3 Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>:
> Pavel Stehule wrote:
>>> My attempt at a syntax that could also cover Peter's wish for multiple
>>> checker functions:
>>>
>>> CHECK FUNCTION { func(args) | ALL [IN SCHEMA schema] [FOR ROLE user] }
>>>  [ USING check_function ] OPTIONS (optname optarg [, ...])
>
>> check_function should be related to one language, so you have to
>> specify language if you would to specify check_function (if we would
>> to have more check functions for one language).
>
> Right, I forgot LANGUAGE:
>
> CHECK FUNCTION { func(args) | ALL IN LANGUAGE pl [IN SCHEMA schema] [FOR ROLE user] }
>  [ USING check_function ] OPTIONS (optname optarg [, ...])
>
> If func(args) is given, the language can be inferred.
>
> Yours,
> Laurenz Albe

Attachment Content-Type Size
check_function-2011-12-07-4.diff text/x-patch 95.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shigeru Hanada 2011-12-07 07:34:45 Re: pgsql_fdw, FDW for PostgreSQL server
Previous Message Tom Lane 2011-12-07 06:16:25 Re: pg_upgrade and relkind filtering