http://www.postgresql.org/docs/7.2/interactive/plpgsql-structure.html
"It is important not to confuse the use of BEGIN/END for grouping statements in
PL/pgSQL with the database commands for transaction control. PL/pgSQL's BEGIN/END are
only for grouping; they do not start or end a transaction. Functions and trigger
procedures are always executed within a transaction established by an outer query ---
they cannot start or commit transactions, since PostgreSQL does not have nested
transactions."
Makes sense if you think about it.
On Thu, 6 Nov 2003, Cris Carampa wrote:
> It seems that transaction management statements (begin work...commit
> work) are not allowed into plpgsql functions. Is it true? If true, what
> happens if I put a DML statement into a function? Is it automatically
> commited every time the function executes? Is there no way to rollback
> the changes?
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
http://archives.postgresql.org