Re: Add column name to error description - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add column name to error description
Date
Msg-id 794292.1711912501@sss.pgh.pa.us
Whole thread Raw
In response to Re: Add column name to error description  (Erik Wienhold <ewie@ewie.name>)
List 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



pgsql-hackers by date:

Previous
From: Michael Banck
Date:
Subject: Re: Security lessons from liblzma
Next
From: Tom Lane
Date:
Subject: Re: Security lessons from liblzma