GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.postgresql.org — Chapter 57. Writing a Procedural Language Handler November 19, 2026: PostgreSQL 19 Released!
Development Versions:
devel
Chapter 57. Writing a Procedural Language HandlerAll calls to functions that are written in a language other than the current “version 1” interface for compiled languages (this includes functions in user-defined procedural languages and functions written in SQL) go through a call handler function for the specific language. It is the responsibility of the call handler to execute the function in a meaningful way, such as by interpreting the supplied source text. This chapter outlines how a new procedural language's call handler can be written. The call handler for a procedural language is a “normal” function that must be written in a compiled language such as C, using the version-1 interface, and registered with PostgreSQL as taking no arguments and returning the type The call handler is called in the same way as any other function: It receives a pointer to a It's up to the call handler to fetch the entry of the function from the Often, the same function is called many times per SQL statement. A call handler can avoid repeated lookups of information about the called function by using the When a procedural-language function is invoked as a trigger, no arguments are passed in the usual way, but the A template for a procedural-language handler written as a C extension is provided in 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 CREATE FUNCTION. An inline handler can be provided to allow the language to support anonymous code blocks executed via the DO command. If a validator is provided by a procedural language, it must be declared as a function taking a single parameter of type Validator functions should typically honor the check_function_bodies parameter: if it is turned off then any expensive or context-sensitive checking should be skipped. If the language provides for code execution at compilation time, the validator must suppress checks that would induce such execution. In particular, this parameter is turned off by pg_dump so that it can load procedural language functions without worrying about side effects or dependencies of the function bodies on other database objects. (Because of this requirement, the call handler should avoid assuming that the validator has fully checked the function. The point of having a validator is not to let the call handler omit checks, but to notify the user immediately if there are obvious errors in a If an inline handler is provided by a procedural language, it must be declared as a function taking a single parameter of type It's recommended that you wrap all these function declarations, as well as the The procedural languages included in the standard distribution are good references when trying to write your own language handler. Look into the Submit correctionIf you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue. |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |