PL/pgSQL
Appearance
PL/pgSQL (Procedural Language/PostgreSQL Structured Query Language) is a procedural language built into the PostgreSQL RDBMS. It closely resembles Oracle's PL/SQL language.
PL/pgSQL, as a true programming language, allows much more control than basic SQL, including the ability to use loops and advanced control structures. Programs created in the PL/PgSQL language are called functions, and can be called as part of a SQL statement, or as the action that a trigger performs.
PL/pgSQL is the only "PL" language installed by default for PostgreSQL, but many others are available, including PL/Perl, PL/python, PL/PHP, PL/Java, PL/sh, PL/Tcl, PL/R, and PL/Ruby.