Re: SPI_exec() + PG_TRY/PG_CATCH

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Aleksandrs Vinogradovs" <avinogradovs(at)Clearpathnet(dot)com>
Cc: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: SPI_exec() + PG_TRY/PG_CATCH
Date: 2007-10-16 20:56:07
Message-ID: 23482.1192568167@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Aleksandrs Vinogradovs" <avinogradovs(at)Clearpathnet(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message jooy 2007-10-16 21:06:41 Re: need help with rebuilding postgresql
Previous Message Guy Rouillier 2007-10-16 20:14:23 Re: How to set config param temporarily?