| From: | Richard Huxton <dev(at)archonet(dot)com> |
|---|---|
| To: | abief_ag_-postgresql(at)yahoo(dot)com |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: transactions in functions, possible bug or what I'm doing |
| Date: | 2004-11-19 12:59:07 |
| Message-ID: | 419DEE1B.6010805@archonet.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Riccardo G. Facchini | 2004-11-19 14:05:47 | CREATE TEMPORARY TABLE .. ON COMMIT DROP question |
| Previous Message | Riccardo G. Facchini | 2004-11-19 11:52:31 | transactions in functions, possible bug or what I'm doing wrong? |