Re: Do Postgres exceptions rise up the stack? - Mailing list pgsql-general

From Postgres User
Subject Re: Do Postgres exceptions rise up the stack?
Date
Msg-id b88c3460706301453v574f3d84s49de8eb32ab990c7@mail.gmail.com
Whole thread Raw
In response to Re: Do Postgres exceptions rise up the stack?  ("Postgres User" <postgres.developer@gmail.com>)
List pgsql-general
Where func A, B, C, and D all update the db.  If an EXCEPTION is raised
in func D(), will all the transactions in the other children be rolled
back?
Or do I need to add code to enable this?

On 6/30/07, Postgres User <postgres.developer@gmail.com> wrote:
> How about this scenario:
>
> func A()
>
> begin
>   x  =  func B();
>   y  =  func C();
>
>   z = func D();
>
> end
>
> Where func A, B, C, and D all update the db.  If a funciton is raised
> in func D(), will all the transactions in the other children be rolled
> back?
> Or do I need to add code to enable this?
>
>
> On 6/30/07, Wiebe Cazemier <halfgaar@gmx.net> wrote:
> > On Saturday 30 June 2007 23:14, Postgres User wrote:
> >
> > > A basic question about raising exceptions in Postgres:
> > >
> > > If  Function A  calls Function B
> > >
> > > and Func B raises an exception, will the exception roll back the
> > > transaction in Func A by default?   Or do I need to trap and re-raise
> > > the exception in Func A?
> > >
> > > Thanks.
> >
> > Any exception aborts the transaction. That's how exceptions work. If you don't
> > catch them, they bubble all the way to the surface. Otherwise it would be too
> > much like if-statement error checking.
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 6: explain analyze is your friend
> >
>

pgsql-general by date:

Previous
From: "Postgres User"
Date:
Subject: Re: Do Postgres exceptions rise up the stack?
Next
From: Wiebe Cazemier
Date:
Subject: Re: Do Postgres exceptions rise up the stack?