Thread: Transactions in PLPGSQL?

Transactions in PLPGSQL?

From
Ken Corey
Date:
Hi All!

Are the BEGIN/END; seen in a typical PL/PGSQL function a transaction wrapper, 
or do I need to add another BEGIN/END block?

Should I just put a 'rollback' in the function, or do I need to do something 
special?

Thanks!

-Ken


Re: Transactions in PLPGSQL?

From
tolik@aaanet.ru (Anatoly K. Lasareff)
Date:
>>>>> "KC" == Ken Corey <zkyar66701p001@sneakemail.com> writes:
KC> Hi All!KC> Are the BEGIN/END; seen in a typical PL/PGSQL function a transaction wrapper, KC> or do I need to add
anotherBEGIN/END block?
 

No, BEGIN & END in plpgsql function are not transaction control
statemens, but elements of plpgsql language. 
KC> Should I just put a 'rollback' in the function, or do I need to do something KC> special?

You _cannot_ use any transaction control statemens (commit, rollback)
into plpgsql function. So all the function must be in transaction block.

-- 
Anatoly K. Lasareff                 Email:    tolik@aaanet.ru 
http://tolikus.hq.aaanet.ru:8080    Phone:      (8632)-710071