Re: transactions in functions, possible bug or what I'm doing

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: transactions in functions, possible bug or what I'm doing
Дата
Msg-id 419DEE1B.6010805@archonet.com
обсуждение исходный текст
Ответ на transactions in functions, possible bug or what I'm doing wrong?  ("Riccardo G. Facchini" <abief_ag_-postgresql@yahoo.com>)
Ответы Re: transactions in functions, possible bug or what I'm doing
Список 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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Riccardo G. Facchini"
Дата:
Сообщение: transactions in functions, possible bug or what I'm doing wrong?
Следующее
От: "Riccardo G. Facchini"
Дата:
Сообщение: CREATE TEMPORARY TABLE .. ON COMMIT DROP question