Re: rollback in C functions

Поиск
Список
Период
Сортировка
От Juan Pablo L
Тема Re: rollback in C functions
Дата
Msg-id CABSYDaZt+FLhkc1XN-ZnSKJ2-XqrHaBft1jCMRvKR+DVXmGUPA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: rollback in C functions  (Chris Mair <chris@1006.org>)
Список pgsql-general
Hi Thanks Chris, yes i have already tested ereport and even made up my own sql state to report and error but from the application i can not access this error code directly (through the PQexec,PQresultErrorField,etc functions because the PGresult returns NULL) but i have to register a callback function that will be called with this error code with the idea to format the error message so i could intercept this and do something, but this does not allow me to have direct access to the flow where this is all happening .. i hope it is clear ...

On 19 February 2015 at 15:02, Chris Mair <chris@1006.org> wrote:
> 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 infor

Hi,

I think you want ereport(), here is an example:
http://www.postgresql.org/docs/9.3/static/xfunc-c.html

Bye,
Chris.



В списке pgsql-general по дате отправления:

Предыдущее
От: Chris Mair
Дата:
Сообщение: Re: rollback in C functions
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: select where true, or select where input = '$var'