Re: how to use SAVEPOINT in stored function - Mailing list pgsql-general

From Volkan YAZICI
Subject Re: how to use SAVEPOINT in stored function
Date
Msg-id 7104a7370512050835l520aa496kcb74c230e05411d4@mail.gmail.com
Whole thread Raw
In response to Re: how to use SAVEPOINT in stored function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 12/5/05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> In plpgsql, you're supposed to use exception blocks instead.

AFAIC, SAVEPOINT usage isn't permitted in any procedural language. But
it also isn't documented. (I couldn't find any phrase mentioning about
this in the docs.)

One more question, if we'd try to use a SAVEPOINT inside an SQL
function, it dumps below error:
  ERROR:  SAVEPOINT is not allowed in a SQL function
  CONTEXT:  SQL function "tmp_func" during startup
But we got below error message if we'd try the same in a pl/pgsql precedure:
  ERROR:  SPI_execute_plan failed executing query "SAVEPOINT svp0":
  SPI_ERROR_TRANSACTION
  CONTEXT:  PL/pgSQL function "tmp_func" line 4 at SQL statement

Is it possible to make the latter error message some more informative
and user-friendly like the one in the previous?


Regards.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: how to use SAVEPOINT in stored function
Next
From: "Ed L."
Date:
Subject: troubleshooting hung postmasters