The Structure of PLpgSQL


The Structure of PL/pgSQL

As mentioned, PL/pgSQL is a block-oriented language. A block can be defined using DECLARE , BEGIN , and END . All variables have to be declared within the DECLARE section and are initialized with NULL every time a block is entered.

PostgreSQL supports database transactions (see Chapter 5, "Understanding Transactions"). Functions and triggers ( triggers are a feature used to start a certain task after a predefined event) can be embedded only in a transaction started by an external query ”they don't start separate transactions, because PostgreSQL doesn't support nested transactions.

Understanding transactions is an extremely important issue; don't confuse BEGIN / END for transaction control with BEGIN / END in PL/pgSQL functions.



PostgreSQL Developer's Handbook2001
PostgreSQL Developer's Handbook2001
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 125

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net