Re: review: CHECK FUNCTION statement

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "Pavel Stehule *EXTERN*" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: CHECK FUNCTION statement
Date: 2011-12-14 15:30:02
Message-ID: D960CB61B694CF459DCFB4B0128514C2073C8C0F@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-12-14 15:36:54 Re: foreign key locks, 2nd attempt
Previous Message Noah Misch 2011-12-14 15:21:29 Re: foreign key locks, 2nd attempt