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: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2011-12-14 20:52:08
Message-ID: CAFj8pRCzpQQKmnYsWXBbMRBTRSMGsAop_snvJHu2QSaAat8DvQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

so removed "quite" option
and removed multiple check regression tests also - there is missing
explicit order of function checking, so regress tests can fail :(

Regards

Pavel

2011/12/14 Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>:
> Pavel Stehule wrote:
>> changes:
>>
>> * fixed warnings
>> * support for options - actually only two options are supported -
>> quite and fatal_errors
>>
>> these options are +/- useful - main reason for their existence is
>> testing of  support of options - processing on CHECK ... stmt side and
>> processing on checker function side.
>>
>> options are send as 2d text array - some like
>> '{{quite,on},{fatal_errors,on}} - so direct call of checker function
>> is possible
>>
>> * regress test for multi check
>
> First of all: It should be "quiet" and not "quite".
>
> The patch applies and builds fine.
>
> It fails one of ist own regression tests, here is the diff:
>
> *** /postgres/cvs/postgresql/src/test/regress/expected/plpgsql.out      2011-12-14 11:50:44.000000000 +0100
> --- /postgres/cvs/postgresql/src/test/regress/results/plpgsql.out       2011-12-14 16:19:45.000000000 +0100
> ***************
> *** 4975,4991 ****
>  end;
>  $$ language plpgsql;
>  check function all in schema plpgsql_check;
> - NOTICE:  checked function "plpgsql_check.fce1()"
>  WARNING:  error in function "plpgsql_check.fce2()"
>  DETAIL:  too few parameters specified for RAISE
>  CONTEXT:  line 3 at RAISE
>  NOTICE:  checked function "plpgsql_check.fce3()"
>  check function all in schema plpgsql_check with (quite);
>  WARNING:  error in function "plpgsql_check.fce2()"
>  DETAIL:  too few parameters specified for RAISE
>  CONTEXT:  line 3 at RAISE
>  check function all in schema plpgsql_check with (fatal_errors);
> - NOTICE:  checked function "plpgsql_check.fce1()"
>  ERROR:  too few parameters specified for RAISE
>  CONTEXT:  PL/pgSQL function "fce2" line 3 at RAISE
>  check function all in schema plpgsql_check with (quite, fatal_errors on);
> --- 4975,4990 ----
>  end;
>  $$ language plpgsql;
>  check function all in schema plpgsql_check;
>  WARNING:  error in function "plpgsql_check.fce2()"
>  DETAIL:  too few parameters specified for RAISE
>  CONTEXT:  line 3 at RAISE
>  NOTICE:  checked function "plpgsql_check.fce3()"
> + NOTICE:  checked function "plpgsql_check.fce1()"
>  check function all in schema plpgsql_check with (quite);
>  WARNING:  error in function "plpgsql_check.fce2()"
>  DETAIL:  too few parameters specified for RAISE
>  CONTEXT:  line 3 at RAISE
>  check function all in schema plpgsql_check with (fatal_errors);
>  ERROR:  too few parameters specified for RAISE
>  CONTEXT:  PL/pgSQL function "fce2" line 3 at RAISE
>  check function all in schema plpgsql_check with (quite, fatal_errors on);
>
> ======================================================================
>
> The "quiet" option is not very intuitive:
>
> test=> CHECK FUNCTION ALL WITH (quite 'off');
> NOTICE:  skip check function "atrig()", it is trigger function
> NOTICE:  skip check function "perl_max(integer,integer)", language "plperl" hasn't checker function
> NOTICE:  checked function "ok()"
> NOTICE:  checked function "newstyle(integer)"
> CHECK FUNCTION
>
> test=> CHECK FUNCTION ALL WITH (quite 'on');
> NOTICE:  skip check function "atrig()", it is trigger function
> CHECK FUNCTION
>
> I understand that "quiet" cannot silence this message, nor
> "skip ..., uses C language" and "skip ..., it uses internal language",
> but that means that it is not very useful as it is.
>
> If all we need is a sample option, I think that "fatal_errors" is
> enough, and I think that is an option that can be useful.
>
> Yours,
> Laurenz Albe

Attachment Content-Type Size
check_function-2011-12-14-3.diff.gz application/x-gzip 25.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2011-12-14 21:16:56 Re: unite recovery.conf and postgresql.conf
Previous Message Andrew Dunstan 2011-12-14 20:34:23 Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64