diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
new file mode 100644
index b8cc16f..a436aeb
*** a/doc/src/sgml/catalogs.sgml
--- b/doc/src/sgml/catalogs.sgml
***************
*** 3652,3657 ****
--- 3652,3669 ----
+ lanchecker
+ oid
+ pg_proc.oid
+
+ This references a correctness check function that is used by
+ CHECK FUNCTION> and CHECK TRIGGER> for in-depth
+ checks of function bodies.
+ Zero if no such function is provided.
+
+
+
+ lanaclaclitem[]
***************
*** 4262,4267 ****
--- 4274,4285 ----
+ tmplchecker
+ text
+ Name of correctness check function, or null if none
+
+
+ tmpllibrarytextPath of shared library that implements language
diff --git a/doc/src/sgml/plhandler.sgml b/doc/src/sgml/plhandler.sgml
new file mode 100644
index 54b88ef..21d043b
*** a/doc/src/sgml/plhandler.sgml
--- b/doc/src/sgml/plhandler.sgml
*************** CREATE LANGUAGE plsample
*** 161,170 ****
Although providing a call handler is sufficient to create a minimal
procedural language, there are two other functions that can optionally
be provided to make the language more convenient to use. These
! are a validator and an
! inline handler. A validator can be provided
! to allow language-specific checking to be done during
! .
An inline handler can be provided to allow the language to support
anonymous code blocks executed via the command.
--- 161,173 ----
Although providing a call handler is sufficient to create a minimal
procedural language, there are two other functions that can optionally
be provided to make the language more convenient to use. These
! are a validator, a checker
! and an inline handler.
! A validator can be provided to allow language-specific checking to be
! done during .
! A checker performs in-depth checks of function bodies via the
! commands and
! .
An inline handler can be provided to allow the language to support
anonymous code blocks executed via the command.
*************** CREATE LANGUAGE plsample
*** 203,208 ****
--- 206,232 ----
+ If a checker is provided by a procedural language, it must be declared
+ as a function taking two arguments, one of type oid> and one of
+ type regclass>. The checker's result is ignored, so it is customarily
+ declared to return void>.
+ The checker will be called whenever a function is checked with
+ CHECK FUNCTION> or CHECK TRIGGER>.
+ The passed-in OID is the OID of the function's pg_proc>
+ row. The passed-in regclass> is the OID of the
+ pg_class> row of the table on which the trigger is defined,
+ or InvalidOid in the case of CHECK FUNCTION>.
+ The checker must fetch these rows in the usual way, and do
+ whatever checking is appropriate.
+ Typical checks include verifying that all referenced database objects
+ actually exist or style checks like verifying that all declared
+ variables are actually used. If the checker finds the function to be okay,
+ it should just return. If it finds a problem, it should report a
+ WARNING> via the normal ereport()> error reporting
+ mechanism.
+
+
+
If an inline handler is provided by a procedural language, it
must be declared as a function taking a single parameter of type
internal>. The inline handler's result is ignored, so it is
diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
new file mode 100644
index 382d297..ef75780
*** a/doc/src/sgml/ref/allfiles.sgml
--- b/doc/src/sgml/ref/allfiles.sgml
*************** Complete list of usable sgml source file
*** 40,45 ****
--- 40,47 ----
+
+
diff --git a/doc/src/sgml/ref/check_function.sgml b/doc/src/sgml/ref/check_function.sgml
new file mode 100644
index ...6549846
*** a/doc/src/sgml/ref/check_function.sgml
--- b/doc/src/sgml/ref/check_function.sgml
***************
*** 0 ****
--- 1,138 ----
+
+
+
+
+ CHECK FUNCTION
+ 7
+ SQL - Language Statements
+
+
+
+ CHECK FUNCTION
+ perform an in-depth check of an existing function
+
+
+
+ CHECK FUNCTION
+
+
+
+
+ CHECK FUNCTION name ( [ [ argmode ] [ argname ] argtype [, ...] ] )
+ | CHECK FUNCTION ALL [ IN LANGUAGE lang_name ] [ IN SCHEMA schema_name ] [ FOR ROLE owner_name ]
+
+
+
+
+ Description
+
+
+ CHECK FUNCTION performs an in-depth check of existing
+ functions if the procedural language supports it (currently only
+ PL/pgSQL is defined with a check function).
+ The checks performed depend on the language, but typically include checks
+ for the existence of database objects referenced by the function or style
+ checks like defined but unused variables.
+
+
+
+ If a problem is found with a function, a WARNING> will be raised.
+
+
+ The form CHECK FUNCTION ALL will check all functions
+ matching the specified criteria. If no criteria are specified, functions in
+ the schemas pg_catalog and information_schema
+ will be excluded from the check.
+
+
+
+
+ Parameters
+
+
+
+ name
+
+
+
+ The name (optionally schema-qualified) of an existing function.
+
+
+
+
+
+ argmode
+
+
+
+ The mode of an argument: IN>, OUT>,
+ INOUT>, or VARIADIC>.
+ If omitted, the default is IN>.
+ Note that CHECK FUNCTION does not actually pay
+ any attention to OUT> arguments, since only the input
+ arguments are needed to determine the function's identity.
+ So it is sufficient to list the IN>, INOUT>,
+ and VARIADIC> arguments.
+
+
+
+
+
+ argname
+
+
+
+ The name of an argument.
+ Note that CHECK FUNCTION does not actually pay
+ any attention to argument names, since only the argument data
+ types are needed to determine the function's identity.
+
+
+
+
+
+ lang_name
+
+
+
+ The name of a procedural language.
+ Specifies that only functions written in this language should
+ be checked.
+
+
+
+
+
+ schema_name
+
+
+
+ Specifies that only functions in this schema should be checked.
+
+
+
+
+
+ owner_name
+
+
+
+ Specifies that only functions owned by this role should be checked.
+
+
+
+
+
+
+
+ Compatibility
+
+
+ The CHECK FUNCTION statement is a
+ PostgreSQL extension.
+
+
+
+
diff --git a/doc/src/sgml/ref/check_trigger.sgml b/doc/src/sgml/ref/check_trigger.sgml
new file mode 100644
index ...d97b396
*** a/doc/src/sgml/ref/check_trigger.sgml
--- b/doc/src/sgml/ref/check_trigger.sgml
***************
*** 0 ****
--- 1,79 ----
+
+
+
+
+ CHECK TRIGGER
+ 7
+ SQL - Language Statements
+
+
+
+ CHECK TRIGGER
+ perform an in-depth check of an existing trigger function
+
+
+
+ CHECK TRIGGER
+
+
+
+
+ CHECK TRIGGER name ON tablename
+
+
+
+
+ Description
+
+
+ CHECK FUNCTION performs an in-depth check of a trigger
+ function if the procedural language supports it (currently only
+ PL/pgSQL is defined with a check function).
+ The checks performed depend on the language, but typically include checks
+ for the existence of database objects referenced by the function or style
+ checks like defined but unused variables.
+
+
+
+ If a problem is found with the function, a WARNING> will be raised.
+
+
+
+
+ Parameters
+
+
+
+ name
+
+
+ The name of a trigger. The trigger function for this trigger will
+ be checked.
+
+
+
+
+
+ table
+
+
+ The name (optionally schema-qualified) of the table or view the trigger
+ is for.
+
+
+
+
+
+
+
+ Compatibility
+
+
+ The CHECK TRIGGER statement is a
+ PostgreSQL extension.
+
+
+
+
diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml
new file mode 100644
index 0995b13..34fc36e
*** a/doc/src/sgml/ref/create_language.sgml
--- b/doc/src/sgml/ref/create_language.sgml
*************** PostgreSQL documentation
*** 23,29 ****
CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name
CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
! HANDLER call_handler [ INLINE inline_handler ] [ VALIDATOR valfunction ]
--- 23,29 ----
CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name
CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
! HANDLER call_handler [ INLINE inline_handler ] [ VALIDATOR valfunction ] [ CHECK checkfunction ]
*************** CREATE [ OR REPLACE ] [ TRUSTED ] [ PROC
*** 217,222 ****
--- 217,249 ----
+
+
+ CHECKcheckfunction
+
+
+ checkfunction is the
+ name of a previously registered function that will be called
+ by CHECK FUNCTION and CHECK TRIGGER
+ to check the bodies of functions defined in the language.
+ If no check function is specified, this kind of check is not available.
+ The check function must take two arguments, one of type oid
+ (the OID of the function to be checked), and one of type regclass
+ (the table with the trigger for CHECK TRIGGER).
+ The check function will typically return void>.
+
+
+
+ A check function would typically perform an in-depth check of the function
+ body, for example that all referenced database objects exist, but it could
+ also check for stylistic problems like defined but unreferenced variables.
+ To signal a problem found during the check, the function should use the
+ ereport() to report a WARNING>.
+ The return value of the function is ignored.
+
+
+
+
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
new file mode 100644
index 7326519..460794e
*** a/doc/src/sgml/reference.sgml
--- b/doc/src/sgml/reference.sgml
***************
*** 68,73 ****
--- 68,75 ----
&alterView;
&analyze;
&begin;
+ &checkFunction;
+ &checkTrigger;
&checkpoint;
&close;
&cluster;