Re: BUG #17421: Core dump in ECPGdo() when calling PostgreSQL API from 32-bit client for RHEL8

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "hirose(dot)masay-01(at)fujitsu(dot)com" <hirose(dot)masay-01(at)fujitsu(dot)com>
Cc: "'Michael Paquier'" <michael(at)paquier(dot)xyz>, "'pgsql-bugs(at)lists(dot)postgresql(dot)org'" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17421: Core dump in ECPGdo() when calling PostgreSQL API from 32-bit client for RHEL8
Date: 2022-06-06 15:01:52
Message-ID: 908758.1654527712@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"hirose(dot)masay-01(at)fujitsu(dot)com" <hirose(dot)masay-01(at)fujitsu(dot)com> writes:
> [Problem]
> The potential problem is no value is set to "message" after PQresultErrorField() is called in ecpg_raise_backend().

Ah-hah. You're right, and this explains the symptoms exactly, because
libpq-generated error results don't contain broken-down fields, so we'd
get a null precisely in cases such as lost connection.

> | if (message == NULL)
> | message = ecpg_gettext("empty message text");

No, that'd be pretty unhelpful. The best response is to substitute
PQerrorMessage(conn) in such cases. We do that in, for example,
postgres_fdw.

(I don't feel a need to change ECPGnoticeReceiver, because that only
deals with NOTICE results which should always have such a field, and
PQerrorMessage wouldn't be relevant to a non-ERROR result anyway.)

Will fix, thanks for the report!

regards, tom lane

Attachment Content-Type Size
ecpg-cope-with-missing-primary-error-field.patch text/x-diff 1.1 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2022-06-06 16:40:59 Re: BUG #17510: cache lookup failed for type
Previous Message Robert Haas 2022-06-06 14:30:07 Re: BUG #17504: psql --single-transaction -vON_ERROR_STOP=1 still commits after client-side error