Re: ROLLBACK in a function?

From: Rory Campbell-Lange <rory(at)campbell-lange(dot)net>
To: Doug McNaught <doug(at)mcnaught(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ROLLBACK in a function?
Date: 2003-05-29 08:58:55
Message-ID: 20030529085855.GA8431@campbell-lange.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 28/05/03, Doug McNaught (doug(at)mcnaught(dot)org) wrote:
> Rory Campbell-Lange <rory(at)campbell-lange(dot)net> writes:
>
> > I understand that functions provide an implied transaction in
> > PostgreSQL.
>
> Not quite. Every SQL statement is executed in its own transaction if
> BEGIN/END are not explicitly used. A statment may cause zero, one or
> many function calls, but they will all execute in that transaction.
>
> > Does that mean one can ROLLBACK/COMMIT within the body of a
> > function?
>
> Not in current versions.

So in my (eg php) code I should do something like this psuedo code?

BEGIN WORK
select function ([params])
if
result == 0
then
rollback
else
commit
end if
END WORK

Rory
--
Rory Campbell-Lange
<rory(at)campbell-lange(dot)net>
<www.campbell-lange.net>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2003-05-29 09:49:18 Re: ROLLBACK in a function?
Previous Message Darko Prenosil 2003-05-29 07:51:27 Re: Can anybody recommend an IDE for writing SQL/PLPSQL