Re: Questions regarding interaction of stored functions

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Questions regarding interaction of stored functions
Date: 2005-03-24 14:59:25
Message-ID: 4242D5CD.9000804@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


>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.
>
>
If any one of the statements within the transaction (including the
function) fails the entire statement will need to rollback.

If you are running 8 you can use savepoints to only have certain
parts of the entire transaction rollback and then continue forward.

Sincerely,

Joshua D. Drake

>So ... I'm a little fuzzy on this. Is there a doc that details this
>behaviour?
>
>TIA.
>
>
>

--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd(at)commandprompt(dot)com - http://www.commandprompt.com
PostgreSQL Replicator -- production quality replication for PostgreSQL

Attachment Content-Type Size
jd.vcf text/x-vcard 285 bytes

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-03-24 15:05:24 Re: How to retrieve the comment for a constraint?
Previous Message Jeff Davis 2005-03-24 14:57:59 Re: Good Books