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

From John R Pierce
Subject Re: rollback in C functions
Date
Msg-id 54E66217.4000207@hogranch.com
Whole thread Raw
In response to Re: rollback in C functions  (Juan Pablo L <jpablolorenzetti@gmail.com>)
Responses Re: rollback in C functions
List pgsql-general
On 2/19/2015 2:02 PM, Juan Pablo L wrote:
> 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

a query that triggers ereport(ERROR,....) should return a PGresult* that
you pass to PQresultStatus(), which should indicate PGRES_FATAL_ERROR,
so you then call PQresultErrorField(PGresult, PG_DIAG_SQLSTATE) to get
back the SQLSTATE code.



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



pgsql-general by date:

Previous
From: Juan Pablo L
Date:
Subject: Re: rollback in C functions
Next
From: Juan Pablo L
Date:
Subject: Re: rollback in C functions