Re: Help with SET TRANSACTION in a function - Mailing list pgsql-general

From Oliver Elphick
Subject Re: Help with SET TRANSACTION in a function
Date
Msg-id 1015277744.1406.61.camel@linda
Whole thread Raw
In response to Help with SET TRANSACTION in a function  (otis_usenet@yahoo.com (OtisUsenet))
List 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 by date:

Previous
From: Luciano Miguel Ferreira Rocha
Date:
Subject: Re: libcrypt.so.2
Next
From: "Krog, Kenneth"
Date:
Subject: Validating Whole Numbers