Re: basic stored proc/transaction question

From: Ben <bench(at)silentmedia(dot)com>
To: Ian Harding <harding(dot)ian(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: basic stored proc/transaction question
Date: 2006-03-24 18:31:31
Message-ID: Pine.LNX.4.64.0603241026530.15001@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Well, that's awesome. Thanks!

On Fri, 24 Mar 2006, Ian Harding wrote:

> On 3/24/06, Ben <bench(at)silentmedia(dot)com> wrote:
>> My understanding is that a stored procedure does an implicit begin/commit when
>> it executes. Maybe my brain isn't working so well this morning, because I can't
>> figure out how I would do:
>>
>> begin;
>> call stored proc;
>> call another stored proc;
>> commit;
>>
>> It seems that the transaction would be committed after the first call.
>>
> Nope. Unless you use the new SAVEPOINT stuff, the explicit
> transaction is the transaction. Any error in any function will
> rollback the whole thing. The commit happens at the explicit commit.
>
> Every SQL statement (such as calling a function) runs in an implicit
> transaction. Explicit transactions effectively "group" these implicit
> transactions such that any one failure causes them all to fail.
>
> - Ian
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Seloua Seloua 2006-03-24 18:36:45 libpq vs pqxx
Previous Message Edmund.Bacon 2006-03-24 18:25:35 When does a check constraint execute?