Missing iso-8859-1 status in PGresult - Mailing list pgsql-hackers

From Hao Wu
Subject Missing iso-8859-1 status in PGresult
Date
Msg-id CY4PR0501MB3906E4E32928FF6DBE0D75F3A4430@CY4PR0501MB3906.namprd05.prod.outlook.com
Whole thread Raw
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: run pgindent on a regular basis / scripted manner
Next
From: Tom Lane
Date:
Subject: Re: Parallel query hangs after a smart shutdown is issued