From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | issue in pgfdw_report_error()? |
Date: | 2021-11-19 08:18:22 |
Message-ID: | 477c16c8-7ea4-20fc-38d5-ed3a77ed616c@oss.nttdata.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
pgfdw_report_error() in postgres_fdw is implemented to report the message
"could not obtain ..." if message_primary is NULL as follows.
But, just before this ereport(), message_primary is set to
pchomp(PQerrorMessage()) if it's NULL. So ISTM that message_primary is
always not NULL in ereport() and the message "could not obtain ..." is
never reported. Is this a bug?
-------------------
if (message_primary == NULL)
message_primary = pchomp(PQerrorMessage(conn));
ereport(elevel,
(errcode(sqlstate),
message_primary ? errmsg_internal("%s", message_primary) :
errmsg("could not obtain message string for remote error"),
-------------------
If this is a bug, IMO the following change needs to be applied. Thought?
-------------------
ereport(elevel,
(errcode(sqlstate),
- message_primary ? errmsg_internal("%s", message_primary) :
+ (message_primary != NULL && message_primary[0] != '\0') ?
+ errmsg_internal("%s", message_primary) :
errmsg("could not obtain message string for remote error"),
-------------------
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
From | Date | Subject | |
---|---|---|---|
Next Message | Shinya Kato | 2021-11-19 08:30:47 | Re: [Proposal] Add foreign-server health checks infrastructure |
Previous Message | Michael Paquier | 2021-11-19 07:58:52 | Re: dfmgr additional ABI version fields |