psql: Fall back to English for unsafe hidden query labels.

This completes the project begun in commit 294d2196c of making
commit 41d69e6dc's hidden query labels safe against unexpected
encoding-related failures.  At that point we were still uncertain
exactly what rule to use to decide that a translated label is safe.
The rule adopted here is: translate the label only when the client
and server encodings match and the translated bytes pass the same
encoding verification check the server will apply.  This is enough
to ensure that no error will be thrown, and it avoids the difficult
task of identifying what encoding gettext() thinks it's using.

Author: shihao zhong <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: 
https://postgr.es/m/CAGRkXqRv7yhBOhF0YvSr6ZB7rvsPCjnXSPj8=3bkcsjuyvn...@mail.gmail.com
Backpatch-through: 19

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f242a81b81f2010e90f575d6987ef2d8b15a493f

Modified Files
--------------
src/bin/psql/common.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)

Reply via email to