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

From Erik Wienhold
Subject Re: Add column name to error description
Date
Msg-id 4b9cff17-103e-4792-98bf-fef46171d7fe@ewie.name
Whole thread Raw
In response to Re: Add column name to error description  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Add column name to error description
List pgsql-hackers
On 2025-03-06 21:56 +0100, Tom Lane wrote:
> jian he <jian.universality@gmail.com> writes:
> > if we print out NameStr(att->attname) then error becomes:
> > +DETAIL:  Returned type unknown does not match expected type character
> > varying in column "f2" (position 2).
> 
> > In this case,  printing out {column \"%s\"} is not helpful at all.
> 
> Actually, the problem is that we should be printing the expected
> column name not the input column name.  At least in the test cases
> we have, that gives a user-supplied name in every case.  Even if
> there are some cases where you just get "f2", that's not horrible.
> So I don't think this is worth the amount of code churn involved in
> the v2 patch --- let's just print it unconditionally, as attached.
> I do still think that including the column number is potentially
> helpful, though, so I didn't remove that.

+1

But I don't see the point in keeping variables atttypid and atttypmod
around when those values are now available via outatt.  Removing these
two variables makes the code easier to read IMO.  Done so in the
attached v4.

-- 
Erik Wienhold

Attachment

pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Parallel heap vacuum
Next
From: Jeff Davis
Date:
Subject: Re: Statistics Import and Export