Re: Help with SET TRANSACTION in a function

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Help with SET TRANSACTION in a function
Дата
Msg-id 20020304221149.J86530-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: Help with SET TRANSACTION in a function  ("otisg" <otisg@iVillage.com>)
Список pgsql-general
On Mon, 4 Mar 2002, otisg wrote:

> > 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?

You use it directly in the sequence of sql commands (for example in psql)
begin;
set transaction isolation level serializable;
select funcfoo();
select * from sometable;
update sometable set somevalue=3 where somevalue=4;
end;

AFAICS you just can't use it inside a function since it needs to be before
the first query the transaction does (the error message it gives otherwise
basically says so anyway) and to get to a function means you're already
processing a query.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: FATAL 2: RelationPutHeapTuple: failed to add tuple
Следующее
От: thiemo
Дата:
Сообщение: Compiling problems