Re: SPI_ERROR_TRANSACTION [PostgreSQL 8.3]

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Daroslav <daroslav(at)g(dot)pl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SPI_ERROR_TRANSACTION [PostgreSQL 8.3]
Date: 2009-04-28 15:16:16
Message-ID: 20090428151616.GM10358@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Daroslav wrote:
>
> Hi
>
> As a newbie in PL/pgSQL I have faced an error SPI_ERROR_TRANSACTION which
> was raised always when I have tried to launch following function with
> uncommented keywords SAVEPOINT, SET TRANSACTION and COMMIT(when commented,
> function works fine):

Yes, you cannot use those constructs in plpgsql (or any other PL for
that matter; it's a limitation of the underlying layer). You need to
use BEGIN/EXCEPTION/END blocks instead.

Also, keep in mind that if you RAISE EXCEPTION, the current transaction
is always rolled back, so the RETURN FALSE in your function would never be
reached.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Katz, Lawrence 2009-04-28 15:18:23 "ERROR: 42883: could not identify an ordering operator for type polygon"
Previous Message Raymond O'Donnell 2009-04-28 15:00:11 Re: What may cause - Connection rejected: FATAL: Ident authentication failed for user?