From d60f10b0e74173653d17c09750a791afe6f56404 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 22 May 2002 17:21:02 +0000 Subject: Add optional "validator" function to languages that can validate the function body (and other properties) as a function in the language is created. This generalizes ad hoc code that already existed for the built-in languages. The validation now happens after the pg_proc tuple of the new function is created, so it is possible to define recursive SQL functions. Add some regression test cases that cover bogus function definition attempts. --- doc/src/sgml/ref/create_language.sgml | 30 ++++++++++++++++++++++++++++-- doc/src/sgml/release.sgml | 8 +++++--- 2 files changed, 33 insertions(+), 5 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml index e5f47be9ffe..42d7c9b4877 100644 --- a/doc/src/sgml/ref/create_language.sgml +++ b/doc/src/sgml/ref/create_language.sgml @@ -1,5 +1,5 @@ @@ -17,7 +17,7 @@ PostgreSQL documentation CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE langname - HANDLER call_handler + HANDLER call_handler [ VALIDATOR valfunction ] @@ -113,6 +113,32 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE langna + + + VALIDATOR valfunction + + + + valfunction is the + name of a previously registered function that will be called + when a new function in the language is created, to validate the + new function. The validator function must take one argument of + type oid, which will be the OID of the + to-be-created function, and can have any return type. If no + validator function is specified, then a new function will not + be checked when it is created. + + + + A validator function would typically inspect the function body + for syntactical correctness, but it can also look at other + properties of the function, for example if the language cannot + handle certain argument types. To signal an error, the + validator function should use the elog() + function. The return value of the function is ignored. + + + diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml index b25b7ef5e38..0bdb095804c 100644 --- a/doc/src/sgml/release.sgml +++ b/doc/src/sgml/release.sgml @@ -1,5 +1,5 @@ @@ -24,6 +24,8 @@ CDATA means the content is "SGML-free", so you can write without worries about funny characters. --> Changes - + Ensure that sequence counters do not go backwards after a crash (Tom) Fix pgaccess kanji-coversion key binding (Tatsuo) Optimizer improvements (Tom) @@ -90,7 +92,7 @@ contrib/tsearch dictionary improvements, see README.tsearch for an additional installation step (Thomas T. Thai, Teodor Sigaev) Fix for array subscripts handling (Tom) Allow EXECUTE of "CREATE TABLE AS ... SELECT" in PL/PgSQL (Tom) - + -- cgit v1.2.3