Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rr0eB-00FBPa-Vg for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 19:15:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rr0e9-00DFdr-UB for pgsql-hackers@arkaria.postgresql.org; Sun, 31 Mar 2024 19:15:13 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rr0e9-00DFdi-KA for pgsql-hackers@lists.postgresql.org; Sun, 31 Mar 2024 19:15:13 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rr0e2-007qqN-GK for pgsql-hackers@lists.postgresql.org; Sun, 31 Mar 2024 19:15:12 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 42VJF1Hc794293; Sun, 31 Mar 2024 15:15:01 -0400 From: Tom Lane To: Erik Wienhold cc: Marcos Pegoraro , PostgreSQL Hackers Subject: Re: Add column name to error description In-reply-to: References: Comments: In-reply-to Erik Wienhold message dated "Sun, 31 Mar 2024 20:57:57 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <794291.1711912501.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 31 Mar 2024 15:15:01 -0400 Message-ID: <794292.1711912501@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Erik Wienhold writes: > On 2024-03-31 15:22 +0200, Marcos Pegoraro wrote: >> This is my first patch, so sorry if I miss something. > Please make sure that tests are passing by running make check: check-world, in fact. > The format "%d-%s" is not ideal. I suggesst "%d (%s)". I didn't like that either, for two reasons: if we have a column name it ought to be the prominent label, but we might not have one if the TupleDesc came from some anonymous source (possibly that case explains the test crash? Although I think the attname would be an empty string rather than missing entirely in such cases). I think it'd be worth providing two distinct message strings: "Returned type %s does not match expected type %s in column \"%s\" (positi= on %d)." "Returned type %s does not match expected type %s in column position %d." I'd suggest dropping the column number entirely in the first case, were it not that the attnames might well not be unique if we're dealing with an anonymous record type such as a SELECT result. regards, tom lane