Re: Questions regarding interaction of stored functions and transactions - Mailing list pgsql-general

From Tom Lane
Subject Re: Questions regarding interaction of stored functions and transactions
Date
Msg-id 26733.1111677140@sss.pgh.pa.us
Whole thread Raw
In response to Questions regarding interaction of stored functions and transactions  (Bill Moran <wmoran@potentialtech.com>)
Responses Re: Questions regarding interaction of stored functions
List pgsql-general
Bill Moran <wmoran@potentialtech.com> writes:
> Let's take the following fictional scenerio:

> BEGIN;
> INSERT INTO table1 VALUES ('somestring');
> INSERT INTO table1 VALUES ('anotherstring');
> SELECT user_defined_function();
> COMMIT;

> In this case, user_defined_function() does a lot more table manipulation.
> I don't want that to be done if any statement prior fails, but it seems as
> if it's always done, regardless.  It seems as if the second INSERT is not
> executed if the first fails, but the function is always called.

Sorry, I don't believe a word of that.  If the first insert fails,
everything will be rejected until COMMIT.

Possibly you need to show a less fictionalized version of your problem.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Good Books
Next
From: Robert Treat
Date:
Subject: Re: Good Books