Re: Missing documentation for error code: 80S01

From: "Donald Fraser" <postgres(at)kiwi-fraser(dot)net>
To: "[JDBC]" <pgsql-jdbc(at)postgresql(dot)org>, "[ADMIN]" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Missing documentation for error code: 80S01
Date: 2011-04-13 09:57:05
Message-ID: 6A526FFBDB9D4EE2947C4E5E282530E3@DEVELOP1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-bugs pgsql-jdbc


From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>

> "Donald Fraser" <postgres(at)kiwi-fraser(dot)net> wrote:
>
>> the JDBC driver does know that the server has terminated the
>> connection [...] (via end of stream or EOF).
>>
>> Is the error class "57" a better prefix for this type of error?
>
> Possibly. Is it really true that the client will see a clean close
> for a canceled query or a clean server shutdown and never see a
> clean close of the TCP connection from the server side for other
> reasons?

Technically yes. When performing a read on the socket you get -1 indicating
EOF or remote socket closed. You don't get an IO error.
The difficult part is what was the client doing when the server closes the
socket?
If the client wasn't doing anything then the next likely action a client
would perform is to execute a query which would involve writing to the
socket first and in this case you will get a broken pipe IO exception,
rather than remote socket closed.
If the client had already executed a query and was attempting to read
response data then you get remote socket closed.

I would like to propose that when a "remote socket closed" is detected that
the JDBC driver uses a different error code to the one used for IO
exceptions.
Currently for IO exceptions error code is: "08S01"
For detection of remote socket closed, the error code should be different -
may be "08S02" or "57P00"?
I'm not really sure where or how these numbers are supposed to be
used/generated.
The "08" class would seem to be the most appropriate since it is
connection related.

Regards
Donald Fraser

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Oliver Jowett 2011-04-13 10:30:17 Re: [JDBC] Missing documentation for error code: 80S01
Previous Message Tom Lane 2011-04-13 00:40:38 Re: WAL archiving disaster

Browse pgsql-bugs by date

  From Date Subject
Next Message Oliver Jowett 2011-04-13 10:30:17 Re: [JDBC] Missing documentation for error code: 80S01
Previous Message Anton Kuznetsov 2011-04-13 09:24:34 BUG #5977: Crash on delete

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2011-04-13 10:30:17 Re: [JDBC] Missing documentation for error code: 80S01
Previous Message Clemens Eisserer 2011-04-12 20:39:19 Re: Howto use "COPY FROM" with the native API?