Re: Help with SET TRANSACTION in a function
От | otisg |
---|---|
Тема | Re: Help with SET TRANSACTION in a function |
Дата | |
Msg-id | 009701c1c401$230adb50$66c9010a@mail2world.com обсуждение исходный текст |
Ответ на | Help with SET TRANSACTION in a function (otis_usenet@yahoo.com (OtisUsenet)) |
Ответы |
Re: Help with SET TRANSACTION in a function
|
Список | pgsql-general |
Hello,
> From: Stephan Szabo
> On Mon, 4 Mar 2002, otisg wrote:
> > 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';
>
> Only declarations go outside the begin. As far as I can see, you
> really just can't put a set transaction isolation level in a function
> and expect it to work. If PostgreSQL had nested transactions you could
> presumably do it then, but it doesn't.
So how does one use SET TRANSACTION...?
I have not been able to find any examples of that in the docs, other than the reference document.
Could you please provide a simple example of how SET TRANSACTION... is used?
Thank you,
Otis
_______________________________________________________________
Get your own FREE email account at iVillage.com!
http://webmail.ivillage.com/
> From: Stephan Szabo
> On Mon, 4 Mar 2002, otisg wrote:
> > 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';
>
> Only declarations go outside the begin. As far as I can see, you
> really just can't put a set transaction isolation level in a function
> and expect it to work. If PostgreSQL had nested transactions you could
> presumably do it then, but it doesn't.
So how does one use SET TRANSACTION...?
I have not been able to find any examples of that in the docs, other than the reference document.
Could you please provide a simple example of how SET TRANSACTION... is used?
Thank you,
Otis
_______________________________________________________________
Get your own FREE email account at iVillage.com!
http://webmail.ivillage.com/
В списке pgsql-general по дате отправления: