From: | jian he <jian(dot)universality(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Erik Wienhold <ewie(at)ewie(dot)name>, Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Add column name to error description |
Date: | 2025-03-07 14:54:25 |
Message-ID: | CACJufxHjUJxPZXE3i=2a=6Cinm=HirY7NmGS611go223DBweBA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Mar 7, 2025 at 11:05 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Erik Wienhold <ewie(at)ewie(dot)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?
>
i think so.
While looking at it, in build_attrmap_by_position
I guess errmsg may be better than errmsg_internal
since there are around 10 related error messages in
src/pl/plpgsql/src/expected/plpgsql_record.out,
so it's user visible.
but I am confused by the below errmsg_internal comments about
translation message infinite error recursion.
/*
* errmsg_internal --- add a primary error message text to the current error
*
* This is exactly like errmsg() except that strings passed to errmsg_internal
* are not translated, and are customarily left out of the
* internationalization message dictionary. This should be used for "can't
* happen" cases that are probably not worth spending translation effort on.
* We also use this for certain cases where we *must* not try to translate
* the message because the translation would fail and result in infinite
* error recursion.
*/
From | Date | Subject | |
---|---|---|---|
Next Message | Jelte Fennema-Nio | 2025-03-07 14:54:28 | Re: [PATCH] New predefined role pg_manage_extensions |
Previous Message | Andres Freund | 2025-03-07 14:53:16 | Re: Refactoring postmaster's code to cleanup after child exit |