Re: Help with SET TRANSACTION in a function

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: OtisUsenet <otis_usenet(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help with SET TRANSACTION in a function
Date: 2002-03-04 21:35:43
Message-ID: 1015277744.1406.61.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Luciano Miguel Ferreira Rocha 2002-03-04 21:38:27 Re: libcrypt.so.2
Previous Message Dino Hoboloney 2002-03-04 21:23:20 Re: SQL statement : list table details