Re: Help with SET TRANSACTION in a function

From: Darren Ferguson <darren(at)crystalballinc(dot)com>
To: otisg <otisg(at)iVillage(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Help with SET TRANSACTION in a function
Date: 2002-03-05 04:23:00
Message-ID: Pine.LNX.4.10.10203042321520.32077-100000@thread.crystalballinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Should you not have DECLARE before you do the SET TRANSACTION ISOLATION
LEVEL SERIALIZABLE

From what i have seen this is what you would need although i am not
absolutely positive about this one

Darren Ferguson

On Mon, 4 Mar 2002, otisg wrote:

> Hello,
> > From: Stephan Szabo
> > On 28 Feb 2002, OtisUsenet wrote:
> >
> > I was wondering if anyone here can help. I could not get any help on
> > pgsql-sql nor pgsql-general mailing lists.
> > >
> > I'm having trouble getting functions with SET TRANSACTION ISOLATION
> > ... to parse.
> >
> > Without nested transactions, you're not going to have any luck I
> think.
> > First of all the extra begin/end in the function are not allowed and
> > IIRC, set transaction isolation level must be the first statement of
> the
> > transaction which it won't be since the enclosing transaction will
> have
> > started the select simple_fun().
>
> Hello,
>
> If I understand it correctly the function should then look like this:
>
> CREATE FUNCTION simple_fun() RETURNS INTEGER AS '
> SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
> BEGIN
> RETURN 1;
> END;
> ' LANGUAGE 'plpgsql';
>
> I have loaded that into my database, but I still get an error:
>
> select simple_fun();
> NOTICE: plpgsql: ERROR during compile of simple_fun near line 1
> ERROR: parse error at or near "SET"
>
> Am I still doing something wrong?
>
> Thanks,
> Otis
> _______________________________________________________________
> Get your own FREE email account at iVillage.com!
> http://webmail.ivillage.com/
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message otisg 2002-03-05 04:49:30 Re: Help with SET TRANSACTION in a function
Previous Message Sean Chittenden 2002-03-05 04:16:42 Re: [ADMIN] password change...