Re: two concurrency questions

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: two concurrency questions
Дата
Msg-id m365qyq4u8.fsf@varsoon.wireboard.com
обсуждение исходный текст
Ответ на two concurrency questions  (Jeff Patterson <jpat@mpip.org>)
Список pgsql-general
Jeff Patterson <jpat@mpip.org> writes:

> I searched the documentation and can't find the specific answers to
> these questions.
>
> 1: Are user defined functions (eg pgplsql) atomic? I.e. if my function
> updates a bunch of rows and one update fails for one reason or another
> does it automatically roll-back to the state before the function was
> called?

Yes, because everything in PG is done inside a transaction, either
implicitly or explicitly.  If you have autocommit on and don't use
BEGIN/COMMIT, each statement is its own transaction.  Since a function
is always called from a statement, functions are atomic.

> 2: If an update causes a trigger and the trigger updates a row and the
> trigger fails, what happens? Is there a way to atomize the whole
> process?

See the answer to #1.

-Doug

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

Предыдущее
От: MAYA NINA
Дата:
Сообщение: Manuales -Tutoriales
Следующее
От: terr@terralogic.net
Дата:
Сообщение: [dpage@vale-housing.co.uk: RE: ODBC docs]