Re: SQLSTATE when PostgreSQL crashes during COMMIT statement

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SQLSTATE when PostgreSQL crashes during COMMIT statement
Дата
Msg-id 26881.1555425074@sss.pgh.pa.us
обсуждение исходный текст
Ответ на RE: SQLSTATE when PostgreSQL crashes during COMMIT statement  ("Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>)
Список pgsql-general
"Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com> 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



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Alter domain type / avoiding table rewrite
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Alter domain type / avoiding table rewrite