Re: SPI_exec - Mailing list pgsql-general

From Jan Wieck
Subject Re: SPI_exec
Date
Msg-id 3D2E15A3.34BEA370@Yahoo.com
Whole thread Raw
In response to SPI_exec  ("Carmen Wai" <wai_carmen@hotmail.com>)
List pgsql-general
Carmen Wai wrote:
>
> Hello:
>
> How can I use the spi_exec in PL/TCL to retrieve the return error code?

Maybe I don't understand completely, but if you execute a query
via spi_exec that results in an ERROR, control never returns into
PL/Tcl (or any other procedural language for that matter).
PostgreSQL does not support error catching yet.

In the PL/Tcl case it does return and you could theoretically
catch it. But there isn't much you can do from there, because
your transaction is already irrevocable in abort state and all
future calls to any spi_* function will result in an error
return. That it does return this way is just to cleanly unwind
the call hirarchy with the Tcl interpreter.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being
right. #
# Let's break this rule - forgive
me.                                  #
#==================================================
JanWieck@Yahoo.com #

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: how to rename an index
Next
From: "Susan Lane"
Date:
Subject: Primary keys and NOT NULL