Re: Add column name to error description

Поиск
Список
Период
Сортировка
От Erik Wienhold
Тема Re: Add column name to error description
Дата
Msg-id 4b9cff17-103e-4792-98bf-fef46171d7fe@ewie.name
обсуждение исходный текст
Ответ на Re: Add column name to error description  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Add column name to error description
Список 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

Вложения

В списке pgsql-hackers по дате отправления: