"Takahashi, Ryohei" <r.takahashi_2@xxxxxxxxxxxxxx> writes: >> So, if the library gives you an error ( "I have not received the commit >> confirmation" , not something like "commit failed" ), you will still >> need to test the data, if you can, to know how the server come back up. > Yes. > I want to know what error does library give to the application on such case. > I supposed it is certain SQLSTATE. libpq, at least, doesn't produce SQLSTATEs for errors that it detects. (It probably should, but that's been a TODO item for a couple of decades now ... so don't hold your breath.) So the best you can do here is to check the error message spelling. A crude but possibly sufficient approach is to assume that once you've got a working connection, *any* error that lacks a SQLSTATE is indicative of connection loss. This idea could fail for cases like out-of-memory, but if your app is at the edge of OOM then giving up might be wise anyway. regards, tom lane