Re: libpq error codes - Mailing list pgsql-general

From Tom Lane
Subject Re: libpq error codes
Date
Msg-id 5062.961605764@sss.pgh.pa.us
Whole thread Raw
In response to libpq error codes  (Denis Perchine <dyp@perchine.com>)
Responses Re: libpq error codes
List pgsql-general
Denis Perchine <dyp@perchine.com> writes:
> If I shutdown postgres between queries I get:

> query: 1024: 'select count(*) from pg_class'
> ResStatus: PGRES_FATAL_ERROR
> Status: 0
> except: pqReadData() --  read() failed: errno=32
> ���������� �����

What version are you running, and are you sure you are using libpq
correctly?  Using psql I see

regression=# select count(*) from pg_class;
 count
-------
   260
(1 row)

< in another window, kill postgres backend >

regression=# select count(*) from pg_class;
FATAL 1:  The system is shutting down
NOTICE:  AbortTransaction and not in in-progress state
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
regression=#

which looks pretty reasonable.

I should also point out that in the current system, normal shutdown
(via pg_ctl stop or 'kill' on the postmaster) produces no such result
because extant backends are allowed to finish their sessions normally.

            regards, tom lane

pgsql-general by date:

Previous
From: Marc Britten
Date:
Subject: boolean isn't boolean?
Next
From: "K Parker"
Date:
Subject: PHP3 support