Re: review: CHECK FUNCTION statement

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: review: CHECK FUNCTION statement
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C2073C8C0F@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на Re: review: CHECK FUNCTION statement  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: review: CHECK FUNCTION statement  (Pavel Stehule <pavel.stehule@gmail.com>)
Список 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
parametersspecified for RAISE CONTEXT:  line 3 at RAISE NOTICE:  checked function "plpgsql_check.fce3()" check function
allin schema plpgsql_check with (quite); WARNING:  error in function "plpgsql_check.fce2()" DETAIL:  too few parameters
specifiedfor 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:
errorin function "plpgsql_check.fce2()" DETAIL:  too few parameters specified for RAISE CONTEXT:  line 3 at RAISE check
functionall in schema plpgsql_check with (fatal_errors); ERROR:  too few parameters specified for RAISE CONTEXT:
PL/pgSQLfunction "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

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Noah Misch
Дата:
Сообщение: Re: foreign key locks, 2nd attempt
Следующее
От: Tom Lane
Дата:
Сообщение: Re: foreign key locks, 2nd attempt