Chapter 37. Procedural Languages

Note: The following description applies both to Postgres-XC and PostgreSQL if not described explicitly.

Postgres-XC allows user-defined functions to be written in other languages besides SQL and C. These other languages are generically called procedural languages (PLs). For a function 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 Postgres-XC and an existing implementation of a programming language. The handler itself is a C language function compiled into a shared object and loaded on demand, just like any other C function.

There are currently four procedural languages available in the standard Postgres-XC distribution: PL/pgSQL (Chapter 38), PL/Tcl (Chapter 39), PL/Perl (Chapter 40), and PL/Python (Chapter 41). There are additional procedural languages available that are not included in the core distribution. Appendix F has information about finding them. In addition other languages can be defined by users; the basics of developing a new procedural language are covered in Chapter 49.