Re: rollback in C functions

From: Juan Pablo L <jpablolorenzetti(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: rollback in C functions
Date: 2015-02-19 21:41:00
Message-ID: CABSYDaYNSqFzH37U6xh0+09PR6+NssXukhPY3HDv3GizKDUP8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, i want previous updates to rollback ... like nothing happened (a normal
begin/rollback behaviour)

On 19 February 2015 at 15:34, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
wrote:

> Juan Pablo L wrote:
> > Hello, i have created a function (in C) that receives an array that
> > contains tuples of ID's and values.
>
> Why are you writing a C function? Sounds like you could accomplish the
> same with a plpgsql function, with much less effort.
>
> > The function is to execute updates on each ID assigning the value, but if
> > one of these operation fails (does not meet certain criteria)
> > inside the function i would like to rollback and leave everything
> > untouched, in case other ID;s were already updated previously,
> > and come back to the caller and inform about it.
>
> Do you want previous updates to remain in place, or do you want to roll
> them back too? This is not clear.
>
>
> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2015-02-19 21:57:23 Re: rollback in C functions
Previous Message Alvaro Herrera 2015-02-19 21:34:00 Re: rollback in C functions