Re: two concurrency questions

From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Jeff Patterson <jpat(at)mpip(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: two concurrency questions
Date: 2003-03-04 20:01:03
Message-ID: m365qyq4u8.fsf@varsoon.wireboard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Patterson <jpat(at)mpip(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2003-03-04 20:02:04 Re: No stats visible?
Previous Message Greg Sabino Mullane 2003-03-04 19:59:39 Mailing lists still points to a non-existent page