Re: rollback in C functions

Поиск
Список
Период
Сортировка
От Juan Pablo L
Тема Re: rollback in C functions
Дата
Msg-id CABSYDab5nMQLYPfCtfayq5mrTmx=HhB720RhnvX-heP0DVJ+Jg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: rollback in C functions  (John R Pierce <pierce@hogranch.com>)
Ответы Re: rollback in C functions  (Juan Pablo L <jpablolorenzetti@gmail.com>)
Список pgsql-general
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 <pierce@hogranch.com> wrote:
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



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: John R Pierce
Дата:
Сообщение: Re: rollback in C functions
Следующее
От: David G Johnston
Дата:
Сообщение: Re: select where true, or select where input = '$var'