Re: How to implement transaction in plpgsql? - Mailing list pgsql-general

From Doug McNaught
Subject Re: How to implement transaction in plpgsql?
Date
Msg-id m3sndphec0.fsf@belphigor.mcnaught.org
Whole thread Raw
In response to How to implement transaction in plpgsql?  ("Corn" <corn@tryit.com>)
List pgsql-general
"Corn" <corn@tryit.com> writes:

> Dear all,
>
> How to implement transaction in plpgsql?
> I have try to use it but fail. And I don't know the reason.
> Here is my function...

You can't use transactions inside a function.  The reason is that when
a function executes you are already inside a transaction (every SQL
statement is a transaction if there is no explicit BEGIN) and PG
doesn't support nested transactions.

See the FAQ for more info; I'm pretty sure this issue is in there (if
not, it should be).

-Doug
--
Free Dmitry Sklyarov!
http://www.freesklyarov.org/

We will return to our regularly scheduled signature shortly.

pgsql-general by date:

Previous
From: "Erol Öz"
Date:
Subject: Ynt: pg_dump error - LOCALIZATION PROBLEM
Next
From: "Mitch Vincent"
Date:
Subject: Re: Case sensitivity issue