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: jian he <jian.universality@gmail.com>, Marcos Pegoraro <marcos@f10.com.br>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-03-07T03:05:38Z
Lists: pgsql-hackers
Erik Wienhold <ewie@ewie.name> writes:
> 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.

I think the idea of the original coding was to keep those values in
registers in the inner loop rather than re-fetching them each time.
But that's probably an unmeasurably microscopic optimization, if
real at all (modern compilers might figure it out for themselves).
Do others agree Erik's version improves readability?

			regards, tom lane



Commits

  1. Include column name in build_attrmap_by_position's error reports.

  2. Instead of supposing (wrongly, in the general case) that the rowtype