Re: Help with SET TRANSACTION in a function

Поиск
Список
Период
Сортировка
От Oliver Elphick
Тема Re: Help with SET TRANSACTION in a function
Дата
Msg-id 1015277744.1406.61.camel@linda
обсуждение исходный текст
Ответ на Help with SET TRANSACTION in a function  (otis_usenet@yahoo.com (OtisUsenet))
Список pgsql-general
On Thu, 2002-02-28 at 16:57, OtisUsenet wrote:
> This is the simple_fun function that is causing the above error:
>
> CREATE FUNCTION simple_fun() RETURNS INTEGER AS '
> BEGIN
>   SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
>   BEGIN;
>   RETURN 1;
>   END;
> END;
> ' LANGUAGE 'plpgsql';
>
> This is as simple as it gets.
> I think my syntax is correct (I checked Practical PostgreSQL
> book as well as a number of 7.2 PDF documents, etc.).
>
> Am I missing a secret ingredient here?

A function already happens inside a transaction, whether implicit or
explicit.  You cannot start another transaction inside it; PostgreSQL
does not support nested transactions.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Give, and it will be given to you. A good measure,
      pressed down, taken together and running over,
      will be poured into your lap. For with the same
      measure that you use, it will be measured to
      you."         Luke 6:38


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

Предыдущее
От: Luciano Miguel Ferreira Rocha
Дата:
Сообщение: Re: libcrypt.so.2
Следующее
От: "Krog, Kenneth"
Дата:
Сообщение: Validating Whole Numbers