Transaction Handling in pl/pgsql

From: "Craig Bryden" <postgresql(at)bryden(dot)co(dot)za>
To: "pgsql" <pgsql-general(at)postgresql(dot)org>
Subject: Transaction Handling in pl/pgsql
Date: 2005-07-12 17:22:06
Message-ID: 000701c58706$3b24fb00$0200a8c0@amd2800
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

I am trying to get a better understanding of how transactions work in
pl/pgsql functions. I found the following text in the help:
"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"
but I am still a bit confused.

Suppose I have a function that will be called from an application. Will all
the statements in the function be rolled back if the last one generates an
exception? or do I need to add code to a function to make that happen?

Thanks
Craig

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Pratt 2005-07-12 17:24:38 Re: Update more than one table
Previous Message David Esposito 2005-07-12 17:17:09 Re: index bloat