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 1037878.1741367955@sss.pgh.pa.us
Whole thread Raw
In response to Re: Add column name to error description  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
jian he <jian.universality@gmail.com> writes:
> 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.

No, you misunderstand how that works:

    errmsg_internal("%s", _(msg)),

The useful translation happens in the invocation of "_(msg)",
that is gettext(msg).  Using errmsg_internal instead of
errmsg just indicates that there's no point in trying to
translate the string "%s".  We do it like this rather than
simply writing

    errmsg(msg),

because of the risk of sprintf doing something unexpected
with '%' characters in the translated message.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Showing primitive index scan count in EXPLAIN ANALYZE (for skip scan and SAOP scans)
Next
From: Robert Haas
Date:
Subject: Re: TOAST versus toast