Re: how to use SAVEPOINT in stored function

From: Volkan YAZICI <volkan(dot)yazici(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: how to use SAVEPOINT in stored function
Date: 2005-12-05 16:35:55
Message-ID: 7104a7370512050835l520aa496kcb74c230e05411d4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/5/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Андрей 2005-12-05 16:59:17 8.1 removed functions
Previous Message Tom Lane 2005-12-05 16:15:54 Re: how to use SAVEPOINT in stored function