|Designed by||Jan Wieck|
|Developer||PostgreSQL Global Development Group|
|First appeared||October 30, 1998|
PL/pgSQL (Procedural Language/PostgreSQL) is a procedural programming language supported by the PostgreSQL ORDBMS. It closely resembles Oracle's PL/SQL language. PL/pgSQL was implemented by Jan Wieck and first appeared with PostgreSQL 6.4, released on October 30, 1998. The current version also implements some ISO SQL/PSM features, like overloading of SQL-invoked functions and procedures.
PL/pgSQL, as a fully featured programming language, allows much more procedural control than SQL, including the ability to use loops and other control structures. Functions created in the PL/pgSQL language can be called from an SQL statement, or as the action that a trigger performs.
PL/pgSQL was created to be able to perform more complex operations and computations than SQL, while being easy to use, and is able to be defined as trusted by the server.
PL/pgSQL is the only programming language installed by default for PostgreSQL, but many others are available, including PL/Java, PL/Perl, PL/pgPSM, PL/php, PL/Python, PL/R, PL/Ruby, PL/sh, PL/Tcl, and PL/Lua. PostgreSQL uses Bison as its parser, so it is easy to port many open source languages, as well as reuse code.
Comparing with PSM
The SQL/PSM language is specified by an ISO standard, but is also inspired by Oracle's PL/SQL and PL/pgPL/SQL, so there are few differences. The PL/pgPSM contributed module implements the standard. The main features of PSM that differ from PL/pgSQL:
- Exception handlers are subroutines (continue handlers);
- Warnings can be handled like an exception;
- Declaration of variables should be based on SQL query result.
- "PostgreSQL Documentation, Appendix E: Release Notes, Release 6.4". PostgreSQL Global Development Group.
- "feature T322", SQL standard features (9 ed.), PostgreSQL.
- "PL/pgSQL – SQL Procedural Language". PostgreSQL. Retrieved 2007-11-15.
- "PL/Java", Gborg (project), PostgreSQL.
- "PL/Perl", Docs (current ed.), PostgreSQL.
- SQL/PSM (manual), PostgreSQL.
- "PL/PHP", Community, Command prompt.
- "PL/Python", Docs (current ed.), PostgreSQL.
- Conway, Joe, PL/R.
- PL/Ruby (project), Ruby lang.
- "Parser stage", Docs (9 ed.), PostgreSQL.
- Stehule, P, "Proposal: PL/pgPSM for pg9.3", Hackers (mailing list), PostgreSQL.
- "C. PL/SQL Program Limits", PL/SQL Language Reference, Database Online Documentation (11g Release 1 (11.1) ed.), Oracle, p. 87,
PL/SQL is based on the programming language Ada.
- "1", Stored procedures (ODP), O’Reilly.
|This programming language–related article is a stub. You can help Wikipedia by expanding it.|