Re: transaction management in plpgsql functions

From: Chester Kustarz <chester(at)arbor(dot)net>
To: Cris Carampa <cris119(at)operamail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: transaction management in plpgsql functions
Date: 2003-11-09 21:14:11
Message-ID: Pine.BSO.4.44.0311091613150.19584-100000@detroit.arbor.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-11-09 22:09:12 Re: transaction processing after error in statement
Previous Message Yasir Malik 2003-11-09 20:59:19 Re: help me...