Re: storing intermediate results in recursive plpgsql functions

Поиск
Список
Период
Сортировка
Искать
От
Gregory Wood
Тема
Re: storing intermediate results in recursive plpgsql functions
Дата
Msg-id
012f01c1c463$da5c4110$7889ffcc@comstock.com
Список
Дерево обсуждения
Re: storing intermediate results in recursive plpgsql functions Fran Fabrizio <ffabrizio@mmrd.com>
Re: storing intermediate results in recursive plpgsql functions Tom Lane <tgl@sss.pgh.pa.us>
Re: storing intermediate results in recursive plpgsql Vince Vielhaber <vev@michvhf.com>
Re: storing intermediate results in recursive plpgsql functions Tom Lane <tgl@sss.pgh.pa.us>
> >>(apprently sql functions do not automatically end
> >>transactions/release locks like plpgsql functions do)
> >
> > Say what?  There's no difference on that score for any kind of function;
> > none of them end transactions or release locks at exit.
>
> "When a PL/pgSQL function locks a table, the lock is released when the
> PL/pgSQL function returns".

I don't see any way in which that could be a true statement. Which is not to
say that it couldn't be a true statement :)

> "You can't have transactions in PL/pgSQL functions.  Every function is
> executed in one transaction."

This is a true statement (although not worded very clearly). Let me give a
shot at making it more understandable:

You can not start or end a transaction inside a function. The reason for
that is rather simple: PostgreSQL does not support nested transactions.
Since all functions are already wrapped in a transaction, implicit or
explicit, they are already inside a transaction, and therefore can not start
a new transaction. For the same reason, you can not end a transaction
because the function is considered an atomic action.

Greg

В списке pgsql-general по дате отправления
От: Masaru Sugawara
Дата:
От: Bill McGonigle
Дата:
FAQ