Thread: Transactions and Locks writing in PLPGSQL

Transactions and Locks writing in PLPGSQL

From
Allan Kamau
Date:
Hi all,
How do I write transaction statements like 'BEGIN
WORK'... in PLPGSQL.
Also how do I write lock statements in the same.
Thank you in advance.

Allan Kamau


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

Re: Transactions and Locks writing in PLPGSQL

From
tolik@aaanet.ru (Anatoly K. Lasareff)
Date:
>>>>> "AK" == Allan Kamau <hugebirdwings@yahoo.com> writes:

 AK> Hi all,
 AK> How do I write transaction statements like 'BEGIN
 AK> WORK'... in PLPGSQL.
 AK> Also how do I write lock statements in the same.
 AK> Thank you in advance.

 AK> Allan Kamau

There is no possibility for this. See (from manual):

(3) You also cannot have transactions in PL/pgSQL procedures. The
entire function (and other functions called from
    therein) is executed in a transaction and PostgreSQL rolls back
the results if something goes wrong. Therefore
    only one BEGIN statement is allowed.

--
Anatoly K. Lasareff                 Email:    tolik@aaanet.ru
                             http://tolikus.hq.aaanet.ru:8080

Re: Transactions and Locks writing in PLPGSQL

From
Sébastien HEITZMANN
Date:
And what happen when the function call an other function. Does this action
also be rolled back if the first fail ?

SEB

----- Original Message -----
From: "Anatoly K. Lasareff" <tolik@aaanet.ru>
To: "Allan Kamau" <hugebirdwings@yahoo.com>
Cc: <pgsql-admin@postgresql.org>
Sent: Thursday, June 14, 2001 7:49 AM
Subject: Re: [ADMIN] Transactions and Locks writing in PLPGSQL


> >>>>> "AK" == Allan Kamau <hugebirdwings@yahoo.com> writes:
>
>  AK> Hi all,
>  AK> How do I write transaction statements like 'BEGIN
>  AK> WORK'... in PLPGSQL.
>  AK> Also how do I write lock statements in the same.
>  AK> Thank you in advance.
>
>  AK> Allan Kamau
>
> There is no possibility for this. See (from manual):
>
> (3) You also cannot have transactions in PL/pgSQL procedures. The
> entire function (and other functions called from
>     therein) is executed in a transaction and PostgreSQL rolls back
> the results if something goes wrong. Therefore
>     only one BEGIN statement is allowed.
>
> --
> Anatoly K. Lasareff                 Email:    tolik@aaanet.ru
>                              http://tolikus.hq.aaanet.ru:8080
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


Re: Transactions and Locks writing in PLPGSQL

From
tolik@aaanet.ru (Anatoly K. Lasareff)
Date:
>>>>> "bH" == bastien HEITZMANN <S> writes:

 bH> And what happen when the function call an other function. Does this action
 bH> also be rolled back if the first fail ?

Yes, sure.



 bH> SEB

 AK> Hi all,
 AK> How do I write transaction statements like 'BEGIN
 AK> WORK'... in PLPGSQL.
 AK> Also how do I write lock statements in the same.
 AK> Thank you in advance.
 >>
 AK> Allan Kamau
 >>
 >> There is no possibility for this. See (from manual):
 >>
 >> (3) You also cannot have transactions in PL/pgSQL procedures. The
 >> entire function (and other functions called from
 >> therein) is executed in a transaction and PostgreSQL rolls back
 >> the results if something goes wrong. Therefore
 >> only one BEGIN statement is allowed.
 >>

--
Anatoly K. Lasareff                 Email:    tolik@aaanet.ru
                             http://tolikus.hq.aaanet.ru:8080