Re: pgsql: libpq: Notice errors a backend may have sent just before dying. - Mailing list pgsql-committers

From Robert Haas
Subject Re: pgsql: libpq: Notice errors a backend may have sent just before dying.
Date
Msg-id CA+TgmoZ=6ZQk5J2tZuSVkBUjrOK-FPQMLpW4uxbdEEz6UY784Q@mail.gmail.com
Whole thread Raw
In response to Re: pgsql: libpq: Notice errors a backend may have sent just before dying.  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgsql: libpq: Notice errors a backend may have sent just before dying.
List pgsql-committers
On Thu, Nov 12, 2015 at 9:29 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <rhaas@postgresql.org> writes:
>> libpq: Notice errors a backend may have sent just before dying.
>> At least since the introduction of Hot Standby, the backend has
>> sometimes sent fatal errors even when no client query was in
>> progress, assuming that the client would receive it.  However,
>> pqHandleSendFailure was not in sync with this assumption, and
>> only tries to catch notices and notifies.  Add a parseInput call
>> to the loop there to fix.
>
> Just for the record, this patch changes no behavior whatsoever.

Actually, yes it does.  I tested.  Without the patch, the message sent
by ac1d7945f866b1928c2554c0f80fd52d7f977772 isn't received by psql.
With the patch, it is.

> It could only make a difference if the backend were still actively
> sending data, which certainly isn't so in the case claimed by the
> commit message.  Moreover, removing the comment that explains why
> only NOTICE and NOTIFY messages will be eaten doesn't make it not so.

I did post an analysis of why I believe these changes are correct on
pgsql-hackers.  Did you read it?  If it's wrong, perhaps you could
respond to that thread. In short, the old comment is appears to me to
be factually wrong: the claim that PGASYNC_IDLE ignores everything but
NOTICE and NOTIFY is at odds with the actual behavior of
pqParseInput3.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: Re: pgsql: libpq: Notice errors a backend may have sent just before dying.
Next
From: Tom Lane
Date:
Subject: Re: pgsql: libpq: Notice errors a backend may have sent just before dying.