Обсуждение: Missing iso-8859-1 status in PGresult

Поиск
Список
Период
Сортировка

Missing iso-8859-1 status in PGresult

От
Hao Wu
Дата:
Hi hackers,

PGRES_FATAL_ERROR is the result status in most cases in the client-side when the backend process raises an error. When the query is failed to execute, PGRES_FATAL_ERROR is returned.
But in another case, PGRES_FATAL_ERROR is also returned. The situation is that the network is broken between the client and the backend immediately after the backend process has committed locally. So the client gets the same result status(PGRES_FATAL_ERROR) with normal errors(transaction failed). But the transaction is actually succeeded.

When the libpq detects an EOF, a PGresult with status PGRES_FATAL_ERROR is returned to the client.
We can check the error message in PGresult to see why an error is returned, but it's unlikely reliable and tricky.

The result status should be unknown in the above case. Because the server has received the request, and the client doesn't get any response from the server, so it may succeed or fail.

Regards,
Hao Wu