Choosing the right language
One of the cool features of PostgreSQL is the privilege for you to write your stored procedures in almost any language you want. Some languages such as SQL, PL/pgSQL, PL/Perl, PL/Python, and PL/Tcl are shipped along with the core of the system. You can also add other languages such as PL/sh, PL/v8, and many more to PostgreSQL to make sure that you always have the language of your choice at hand when you want to write a procedure.
Tip
The listing at https://wiki.postgresql.org/wiki/PL_Matrix contains an overview of all procedural languages available.
To enable a procedural language, you can call CREATE LANGUAGE
.
test=# \h CREATE LANGUAGE Command: CREATE LANGUAGE Description: define a new procedural language Syntax: CREATE [ OR REPLACE ] [ PROCEDURAL ] LANGUAGE name CREATE [ OR REPLACE ] [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name HANDLER call_handler [ INLINE inline_handler ] [ VALIDATOR valfunction ]
To enable PL/Perl, just call this command:
CREATE LANGUAGE plperl...