libpq error codes
От | Denis Perchine |
---|---|
Тема | libpq error codes |
Дата | |
Msg-id | 0006211348540E.30655@dyp обсуждение исходный текст |
Ответы |
Re: libpq error codes
|
Список | pgsql-general |
Hello all, I try to add automatical connection restoring possibility to my app. And I have the following problem: When I execute query I have: query: 1024: 'select count(*) from pg_class' ResStatus: PGRES_TUPLES_OK Status: 0 ResStatus is the result of PQresultStatus, Status is the result of PQstatus. If I shutdown postgres between queries I get: query: 1024: 'select count(*) from pg_class' ResStatus: PGRES_FATAL_ERROR Status: 0 except: pqReadData() -- read() failed: errno=32 ���������� ����� query: 1024: 'select count(*) from pg_class' FATAL 1: The system is shutting down NOTICE: AbortTransaction and not in in-progress state Status: 1 except: pqReadData() -- backend closed the channel unexpectedly. This probably means the backend terminated abnormally before or while processing the request. Please note, that Status is 0 in the first case. There's already no any backend on the other side but Status is still OK. That's bad... And the second query just return NULL to PQexec. The problem is that I cannot properly distinguish between errors in SQL, or some incorrect SQL usage and situations when connection is lost and I should try to reconnect. Any ideas how this can be implemented? -- Sincerely Yours, Denis Perchine ---------------------------------- E-Mail: dyp@perchine.com HomePage: http://www.perchine.com/dyp/ FidoNet: 2:5000/120.5 ----------------------------------
В списке pgsql-general по дате отправления: