transactions surrounding extension functions

Поиск
Список
Период
Сортировка
От Forest Wilkinson
Тема transactions surrounding extension functions
Дата
Msg-id ts27ts498olm1t3btnddev9kss00etofn5@4ax.com
обсуждение исходный текст
Ответы Re: transactions surrounding extension functions  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-sql
According to the postgres 7 docs:

>By default, Postgres executes transactions in unchained mode (also 
>known as “autocommit” in other database systems). In other words, each 
>user statement is executed in its own transaction and a commit is 
>implicitly performed at the end of the statement (if execution was 
>successful, otherwise a rollback is done). 

Does this mean that when I call a function I wrote, which is composed of
several queries, each of those queries will be executed in its own
transaction?  Or, will the statement containing the function call be
executed in its own transaction, thereby including all the queries
composing my function in that same transaction?

This is important when I have a function that performs a SELECT...FOR
UPDATE, followed by an UPDATE to the selected rows.  If I call that
function without surrounding it with BEGIN and END, the former behavior
would be dangerous, while the latter behavior would be desirable.

Thanks,

Forest Wilkinson



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

Предыдущее
От: John Hasler
Дата:
Сообщение: Re: memory usage
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: transactions surrounding extension functions