rollback in C functions

From: Juan Pablo L <jpablolorenzetti(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: rollback in C functions
Date: 2015-02-19 20:45:40
Message-ID: CABSYDaYHGYL2i4fGQiGYUgcG9-k+GMY2kXv=wwsuEeXjp+uMvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello, i have created a function (in C) that receives an array that
contains tuples of ID's and values.

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.

I have read all over that it is not posible to do rollback inside a
function because each function is executed inside a transaction
so inside the function you dont have control over BEGIN/ROLLBACK, but i m
sure there is a way to do this, can anyone please give me a hint
how this is accomplished ? thank you!!!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2015-02-19 20:51:03 Re: select where true, or select where input = '$var'
Previous Message Juan Pablo L. 2015-02-19 20:42:19 rollback in function