Re: rollback in C functions - Mailing list pgsql-general

From Juan Pablo L
Subject Re: rollback in C functions
Date
Msg-id CABSYDabOMzOse4QXZLMtOsSequgBNxPOJVOcYpTXWukdHdu1Yg@mail.gmail.com
Whole thread Raw
In response to Re: rollback in C functions  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: rollback in C functions
List pgsql-general
Thank you Alvaro, i m afraid ereport seems to be the way, that it is complicated to catch this error code in the code of the caller. cause you have to use a callback etc etc

On 19 February 2015 at 15:57, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
Juan Pablo L wrote:
> Hi, i want previous updates to rollback ... like nothing happened (a normal
> begin/rollback behaviour)

Ah, so ereport() is exactly what you want, like Chris Mair said.
Assuming you wrote it correctly, you should see the ERROR line in the
server logs (set log_message_verbosity=verbose in postgresql.conf to see
the full details such as the sqlstate etc).  Did you notice you must add
an extra ( before errmsg and other sub-calls within the ereport call?

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: rollback in C functions
Next
From: John R Pierce
Date:
Subject: Re: rollback in C functions