oid. The validator's result is ignored, so it is customarily declared to return
void. The validator will be called at the end of a
CREATE FUNCTIONcommand that has created or updated a function written in the procedural language. The passed-in OID is the OID of the function's
pg_procrow. The validator must fetch this row in the usual way, and do whatever checking is appropriate. First, call
CheckFunctionValidatorAccess()to diagnose explicit calls to the validator that the user could not achieve through
CREATE FUNCTION. Typical checks then include verifying that the function's argument and result types are supported by the language, and that the function's body is syntactically correct in the language. If the validator finds the function to be okay, it should just return. If it finds an error, it should report that via the normal
ereport()error reporting mechanism. Throwing an error will force a transaction rollback and thus prevent the incorrect function definition from being committed.
CREATE FUNCTIONcommand.) While the choice of exactly what to check is mostly left to the discretion of the validator function, note that the core
CREATE FUNCTIONcode only executes
SETclauses attached to a function when
check_function_bodiesis on. Therefore, checks whose results might be affected by GUC parameters definitely should be skipped when
check_function_bodiesis off, to avoid false failures when reloading a dump.
internal. The inline handler's result is ignored, so it is customarily declared to return
void. The inline handler will be called when a
DOstatement is executed specifying the procedural language. The parameter actually passed is a pointer to an
InlineCodeBlockstruct, which contains information about the
DOstatement's parameters, in particular the text of the anonymous code block to be executed. The inline handler should execute this code and return.
CREATE LANGUAGEcommand itself, into an extension so that a simple
CREATE EXTENSIONcommand is sufficient to install the language. See Section 37.17 for information about writing extensions.
src/plsubdirectory of the source tree. The CREATE LANGUAGE reference page also has some useful details.