PostgreSQL allows users to add new
programming languages to be available for writing functions and
procedures. These are called procedural
languages (PL). In the case of a function or trigger
procedure written in a procedural language, the database server has
no built-in knowledge about how to interpret the function's source
text. Instead, the task is passed to a special handler that knows
the details of the language. The handler could either do all the
work of parsing, syntax analysis, execution, etc. itself, or it
could serve as "glue" between
PostgreSQL and an existing implementation
of a programming language. The handler itself is a special
programming language function compiled into a shared object and
loaded on demand.
Writing a handler for a new procedural language is described in
Section 9.8. Several procedural languages are
available in the standard PostgreSQL
distribution, which can serve as examples.