commit/rollback in postgre 8.2

Started by IPSabout 17 years ago4 messagesgeneral
Jump to latest
#1IPS
sethi@nic.in

Is it possible to use begin, commit and rollback commands within a transaction block in SQL function in postgre ver 8.2

with regards,

I.P.S. Sethi

#2Ashish Karalkar
ashish.karalkar@enterprisedb.com
In reply to: IPS (#1)
Re: commit/rollback in postgre 8.2

IPS wrote:

Is it possible to use begin, commit and rollback commands within a
transaction block in SQL function in postgre ver 8.2

with regards,

I.P.S. Sethi

I guess you can use nested blocks in side a function(BEGIN,END) but not
commit because a SQL function runs as a single transaction.

With Regards
Ashish Karalkar
EnterpriseDB

In reply to: Ashish Karalkar (#2)
Re: commit/rollback in postgre 8.2

On 09/03/2009 10:34, Ashish Karalkar wrote:

IPS wrote:

Is it possible to use begin, commit and rollback commands within a
transaction block in SQL function in postgre ver 8.2

I guess you can use nested blocks in side a function(BEGIN,END) but not
commit because a SQL function runs as a single transaction.

He could use SAVEPOINT to do something similar -

http://www.postgresql.org/docs/8.2/static/sql-savepoint.html

- though it might or might not work for him, depending on his needs.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

#4Grzegorz Jaśkiewicz
gryzman@gmail.com
In reply to: IPS (#1)
Re: commit/rollback in postgre 8.2

On Mon, Mar 9, 2009 at 8:25 AM, IPS <sethi@nic.in> wrote:

 Is it possible to use begin, commit and rollback commands within a
transaction block in  SQL function in postgre ver 8.2

if you want to break plpgsql function, use exceptions. That will cause
transaction (which in it self is the whole procedure) to be rolled
back.

--
GJ