Re: rollback in C functions

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Juan Pablo L <jpablolorenzetti(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: rollback in C functions
Date: 2015-02-19 21:57:23
Message-ID: 20150219215723.GM2500@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2015-02-19 21:59:47 Re: rollback in C functions
Previous Message Juan Pablo L 2015-02-19 21:41:00 Re: rollback in C functions