Re: Add column name to error description
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Erik Wienhold <ewie@ewie.name>
Cc: Marcos Pegoraro <marcos@f10.com.br>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-03-31T19:15:01Z
Lists: pgsql-hackers
Erik Wienhold <ewie@ewie.name> 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\" (position %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
Commits
-
Include column name in build_attrmap_by_position's error reports.
- 34c3c5ce1c0b 18.0 landed
-
Instead of supposing (wrongly, in the general case) that the rowtype
- 12b1b5d837b5 8.0.0 cited