From: Richard Huxton <dev@archonet.com>
To: abief_ag_-postgresql@yahoo.com
Cc: pgsql-sql@postgresql.org
Subject: Re: transactions in functions, possible bug or what I'm doing
Date: Fri, 19 Nov 2004 12:59:07 +0000
Message-ID: <419DEE1B.6010805@archonet.com> (raw)
In-Reply-To: <20041119115231.27648.qmail@web13924.mail.yahoo.com>
References: <20041119115231.27648.qmail@web13924.mail.yahoo.com>
Riccardo G. Facchini wrote:
> Why does select test_without_transaction();
> return this info:
> "ABCD" (as should be)
>
> and select test_with_transaction();
> returns this error?
>
> ERROR: SPI_prepare() failed on "start transaction"
> CONTEXT: PL/pgSQL function "test_with_transaction" line 6 at SQL
> statement
>
> I've been investigating the matter in the doc I have, but to no avail.
> google was not helpful either.
The function-call is already within a transaction (every command is),
and you can't have nested transactions in 7.4.
You can have what are called "savepoints" in version 8.0 though, which
lets you trap errors and rollback to a named (saved) point in your function.
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, abief_ag_-postgresql@yahoo.com
Subject: Re: transactions in functions, possible bug or what I'm doing
In-Reply-To: <419DEE1B.6010805@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox