Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnz6O-0000jX-Ps for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Nov 2021 08:18:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mnz6N-0007J4-FZ for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Nov 2021 08:18:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnz6N-0007Iu-6H for pgsql-hackers@lists.postgresql.org; Fri, 19 Nov 2021 08:18:31 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mnz6G-00070h-KU for pgsql-hackers@lists.postgresql.org; Fri, 19 Nov 2021 08:18:30 +0000 Received: from [192.168.11.7] (p2638163-ipngn12701funabasi.chiba.ocn.ne.jp [180.59.132.163]) by oss.nttdata.com (Postfix) with ESMTPSA id B4F846079E for ; Fri, 19 Nov 2021 17:18:22 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.4 at oss.nttdata.com Message-ID: <477c16c8-7ea4-20fc-38d5-ed3a77ed616c@oss.nttdata.com> Date: Fri, 19 Nov 2021 17:18:22 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Content-Language: en-US To: pgsql-hackers@lists.postgresql.org From: Fujii Masao Subject: issue in pgfdw_report_error()? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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