Skip site navigation (1) Skip section navigation (2)

Re: PL/pgSQL equivalent to PQtransactionStatus?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Christophe <xof(at)thebuild(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: PL/pgSQL equivalent to PQtransactionStatus?
Date: 2008-07-31 18:12:32
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Christophe wrote:
> My apologies if this is in the docs and I missed it, but is there a 
> PL/pgSQL function equivalent for the pglib function PQtransactionStatus 
> (i.e., a way to find out if we're in an open transaction block, and if 
> that transaction is in an error status)?

A pl/pgsql function *always* executes within a transaction.

If an error occurs while that function is executing you can catch the 
exception (see the "Trapping Errors" section of the pl/pgsql docs).

If an error occurs before the function executes then no other statements 
will be executed.


   Richard Huxton
   Archonet Ltd

In response to


pgsql-general by date

Next:From: Bob PawleyDate: 2008-07-31 18:17:44
Subject: Re: Cursor Error
Previous:From: David R RobisonDate: 2008-07-31 18:12:05
Subject: Re: Doing an LDAP lookup from a SQL SELECT

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group