PL/pgSQL
PL/pgSQL
Postgresql elephant.svg
Designed by Jan Wieck
Developer PostgreSQL Global Development Group
First appeared October 30, 1998; 19 years ago (1998-10-30)
Website www.postgresql.org/docs/current/static/plpgsql.html
Influenced by
PL/SQL, Ada

PL/pgSQL (Procedural Language/PostgreSQL) is a procedural programming language supported by the PostgreSQL ORDBMS. It closely resembles Oracle's PL/SQL language. Implemented by Jan Wieck, PL/pgSQL first appeared with PostgreSQL 6.4, released on October 30, 1998.[1] Version 9 also implements some ISO SQL/PSM features, like overloading of SQL-invoked functions and procedures.[2]

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. SQL statements and triggers can call functions created in the PL/pgSQL language.

The design of PL/pgSQL aimed to allow Postgresql users to perform more complex operations and computations than SQL, while providing ease of use. The language is able to be defined as trusted by the server.[3]

PL/pgSQL is one of the programming languages included in the standard PostgreSQL distribution[4], the others being PL/Tcl, PL/Perl[5] and PL/Python[6]. In addition many others are available from third parties, including PL/Java,[7] PL/pgPSM,[8] PL/php,[9] PL/R,[10] PL/Ruby,[11]PL/sh, PL/Lua and PL/v8. PostgreSQL uses Bison as its parser,[12] making it easy to port many open-source languages, as well as to 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:[8][13]

  • Exception handlers are subroutines (continue handlers);
  • Warnings can be handled like an exception;
  • Declaration of variables should be based on SQL query result.

All three languages (Oracle PL/SQL,[14] PostgreSQL PL/pgSQL and ISO SQL/PSM[15]) are originally descended from the Ada programming language.

Inline documentation external support

Formal pseudo-language for documentation, can be embedded into SQL and PL/pgSQL scripts, and will be processed (documentation data-extraction and documentation hypertext generation) by an external tool, the documentation generator. Some of these tools have support to PL/SQL, so, it is expected to support also PL/pgSQL, in full or partial support.

Tool Full PL/pgSQL Javadoc style Other style PL/pgSQL projects using it
Document! X ? yes yes  ?
Natural Docs ? no yes  ?
ROBODoc ? yes no  ?

Other documentation tools: Doxygen, DBScribe, HyperSQL, Universal Report.

References

  1. ^ "PostgreSQL Documentation, Appendix E: Release Notes, Release 6.4". PostgreSQL Global Development Group. 
  2. ^ "feature T322", SQL standard features (9 ed.), PostgreSQL .
  3. ^ "PL/pgSQL - SQL Procedural Language". PostgreSQL. Retrieved . 
  4. ^ "Procedural Languages". 
  5. ^ "PL/Perl", Docs (current ed.), PostgreSQL .
  6. ^ "PL/Python", Docs (current ed.), PostgreSQL .
  7. ^ "PL/Java", Gborg (project), PostgreSQL .
  8. ^ a b SQL/PSM (manual), PostgreSQL .
  9. ^ "PL/PHP", Community, Command prompt .
  10. ^ Conway, Joe, PL/R .
  11. ^ PL/Ruby (project), Ruby lang .
  12. ^ "Parser stage", Docs (9 ed.), PostgreSQL 
  13. ^ Stehule, P, "Proposal: PL/pgPSM for pg9.3", Hackers (mailing list), PostgreSQL .
  14. ^ "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. 
  15. ^ "1", Stored procedures (ODP), O'Reilly .

External links



  This article uses material from the Wikipedia page available here. It is released under the Creative Commons Attribution-Share-Alike License 3.0.

PL/pgSQL
 



 

Connect with defaultLogic
What We've Done
Led Digital Marketing Efforts of Top 500 e-Retailers.
Worked with Top Brands at Leading Agencies.
Successfully Managed Over $50 million in Digital Ad Spend.
Developed Strategies and Processes that Enabled Brands to Grow During an Economic Downturn.
Taught Advanced Internet Marketing Strategies at the graduate level.


Manage research, learning and skills at defaultLogic. Create an account using LinkedIn or facebook to manage and organize your Digital Marketing and Technology knowledge. defaultLogic works like a shopping cart for information -- helping you to save, discuss and share.


  Contact Us