Re: SPI_exec() + PG_TRY/PG_CATCH - Mailing list pgsql-general

From Tom Lane
Subject Re: SPI_exec() + PG_TRY/PG_CATCH
Date
Msg-id 23482.1192568167@sss.pgh.pa.us
Whole thread Raw
In response to SPI_exec() + PG_TRY/PG_CATCH  ("Aleksandrs Vinogradovs" <avinogradovs@Clearpathnet.com>)
List pgsql-general
"Aleksandrs Vinogradovs" <avinogradovs@Clearpathnet.com> writes:
> How do I handle SPI errors properly without rethrowing them or
> using subtransactions ?

Those are your only two choices.

> My current code works (simple PG_CATCH()
> with resseting of error state), but reports reference leaks for
> every failed SPI_exec() call...

The warnings are the least of your worries.  Without a subxact abort,
there is all sorts of state that has not been properly cleaned up.

            regards, tom lane

pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: improvement proposition
Next
From: jooy
Date:
Subject: Re: need help with rebuilding postgresql