Re: BEGIN EXCEPTION END - small bug?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Schuchardt <daniel_schuchardt(at)web(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: BEGIN EXCEPTION END - small bug?
Date: 2004-08-13 19:16:28
Message-ID: 26094.1092424588@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Schuchardt <daniel_schuchardt(at)web(dot)de> writes:
> i tried a bit with errorhandling and found the following :
> (i want to ignore the dublicate key exception)

> ERROR: SPI_prepare failed for "ROLLBACK": SPI_ERROR_TRANSACTION

You can't use ROLLBACK inside a plpgsql function. I agree that this
error message leaves something to be desired, though.
[ ... sounds of hacking ... ]
Now it says

regression=# select test();
ERROR: cannot begin/end transactions in PL/pgSQL
HINT: Use a BEGIN block with an EXCEPTION clause instead.
CONTEXT: PL/pgSQL function "test" line 5 at SQL statement
regression=#

That might still leave you a bit confused, since you *were* using
an EXCEPTION clause, but offhand it seems about the best we can do.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-08-13 19:20:56 Re: Referencing OLD/NEW Rows on Trigger Definition
Previous Message Tom Lane 2004-08-13 19:13:10 Re: Postgres development model