Procedural language
PostgreSQL provides the ability create user-defined functions or trigger procedures in languages other than SQL and C. These languages are referred to as "Procedural Languages
" (PLs) and are a powerful way of extending PostgreSQL.
PostgreSQL's inbuilt procedural language
is PL/pgSQL and is present by default in all databases. Three other procedural languages - PL/Perl
, PL/Python
and PL/Tcl
- form part of the base PostgreSQL distribution but need to be explicitly enabled when compiling PostgreSQL. (Most package management systems include these as seperate packages).
A number of other procedural languages maintained by third-party projects but not included in the PostgreSQL base distribution are also available; see the list below for details.
Note that procedural languages (with the exception of PL/pgSQL
) must be explicitly enabled for each database where they are to be used. Procedural languages can only be enabled by a database superuser.
Available procedural languages
Core procedural languages
Externally maintained procedural languages
References
- PostgreSQL documentation: Procedural Languages
- PostgreSQL documentation: Appendix H.3. - Procedural Languages
Useful links
- Creating a PostgreSQL procedural language - Part 1: Setup - 2020 2ndQuadrant blog article
- Creating a PostgreSQL procedural language - Part 2: Embedding Julia - 2020 2ndQuadrant blog article