Re: Question on how to conditionally commit or rollback a sql-request - Mailing list pgsql-general

From Daniel Verite
Subject Re: Question on how to conditionally commit or rollback a sql-request
Date
Msg-id 1aa503f7-6b03-4785-96fa-f6d16933e4ff@mm
Whole thread Raw
In response to Question on how to conditionally commit or rollback a sql-request  ("Bergbom Staffan" <Staffan.Bergbom@lm.se>)
List pgsql-general
    Bergbom Staffan wrote:

> I get the following error:
> ERROR: SPI execute_plan failed executing query “Commit”:
> SPI_ERROR_TRANSACTION
> CONTEXT: Pl/pgSQL function “objectdescription_bu” line 9 at SQL statement
>
> What does this mean and what should I do to be able to do the desired check

It's not possible to commit or rollback inside a function.
Instead of issuing a rollback, you could raise an exception, and instead of
doing a commit, you should do nothing at all.

Best regards,
--
Daniel
PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org

pgsql-general by date:

Previous
From: Matthias Dietrich
Date:
Subject: Upgraded from Leopard to Snow Leopard - PostgreSQL won't start anymore
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Save MySQL? HA