Just an update, it was making a mistake, the execution of PQexecute, to
execute the query, was wrapped in a function called "PGresult
*db_execute()" that was returning the PGresult as NULL, i completely
forgot this, inside that function the exception was being caught and
discarded so by the tim
i tried this but the call to PQresultErrorField(PGresult, PG_DIAG_SQLSTATE)
is returning NULL, this is what trigger the exception in the function code:
ereport(ERROR,(errcode(ERRCODE_SQL_ROUTINE_EXCEPTION),errmsg("Plan with id
%s does not allow balance with id %s",plan_id,in_balanceid)));
and thi
Thank you, i will try this, honestly i was checking if PGResult is NULL,
when i trigger the exception i always get NULL so i did not any further but
i will try this .
On 19 February 2015 at 16:22, John R Pierce wrote:
> On 2/19/2015 2:02 PM, Juan Pablo L wrote:
>
>> Thank you Alvaro, i m afr
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
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
wrote:
> Juan Pablo L wrote:
> > Hi, i want previous updates to rollback ...
On 2/19/2015 1:41 PM, Juan Pablo L wrote:
Hi, i want previous updates to rollback ... like nothing happened (a
normal begin/rollback behaviour)
so thrown an exception. The actual rollback has to be invoked by the
client application program, which should catch the error thrown by the
query t
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_verbosit
Hi, i want previous updates to rollback ... like nothing happened (a normal
begin/rollback behaviour)
On 19 February 2015 at 15:34, Alvaro Herrera
wrote:
> Juan Pablo L wrote:
> > Hello, i have created a function (in C) that receives an array that
> > contains tuples of ID's and values.
>
> Why
Juan Pablo L wrote:
> Hello, i have created a function (in C) that receives an array that
> contains tuples of ID's and values.
Why are you writing a C function? Sounds like you could accomplish the
same with a plpgsql function, with much less effort.
> The function is to execute updates on each
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 funct
> 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 cal
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 eve
12 matches
Mail list logo