From 8e756854de95794f3d30584cee70b94b5822e424 Mon Sep 17 00:00:00 2001 From: Hayato Kuroda Date: Wed, 27 Sep 2023 12:12:16 +0000 Subject: [PATCH v31] Fix description for handling of non-printable ASCII characters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 45b1a67a changed the behavior when characters that are not printable ASCII were used for three configuration parameters (application_name, cluster_name, and postgres_fdw.application_name), but it was not documented. This commit fixes that. PG15 and prior: ``` postgres=# SET application_name TO 'あああ'; SET postgres=# SHOW application_name ; application_name ------------------ ????????? (1 row) ``` PG16 and later: ``` postgres=# SET application_name TO 'あああ'; SET postgres=# SHOW application_name ; application_name -------------------------------------- \xe3\x81\x82\xe3\x81\x82\xe3\x81\x82 (1 row) ``` --- doc/src/sgml/config.sgml | 22 ++++++++++++++-------- doc/src/sgml/postgres-fdw.sgml | 12 +++++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 38684af5b1..9163e55c6d 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -6892,9 +6892,11 @@ local0.* /var/log/postgresql The name will be displayed in the pg_stat_activity view and included in CSV log entries. It can also be included in regular log entries via the parameter. - Only printable ASCII characters may be used in the - application_name value. Other characters will be - replaced with question marks (?). + The bytes of the string which are not printable ASCII, like + \x03, are replaced with the + PostgreSQL C-style escaped hexadecimal byte + value. @@ -7889,11 +7891,15 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv; The name can be any string of less than NAMEDATALEN characters (64 characters in a standard - build). Only printable ASCII characters may be used in the - cluster_name value. Other characters will be - replaced with question marks (?). No name is shown - if this parameter is set to the empty string '' (which is - the default). This parameter can only be set at server start. + build). + The bytes of the string which are not printable ASCII, like + \x03, are replaced with the + PostgreSQL C-style escaped hexadecimal byte + value. + No name is shown if this parameter is set to the empty string + '' (which is the default). This parameter can only + be set at server start. diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index 5062d712e7..dcbcf84911 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -1064,12 +1064,14 @@ postgres=# SELECT postgres_fdw_disconnect_all(); postgres_fdw.application_name can be any string - of any length and contain even non-ASCII characters. However when - it's passed to and used as application_name + of any length and contain even characters that are not printable ASCII. + However when it's passed to and used as application_name in a foreign server, note that it will be truncated to less than - NAMEDATALEN characters and anything other than - printable ASCII characters will be replaced with question - marks (?). + NAMEDATALEN characters and the bytes of the string that + are not printable ASCII characters are replaced with the + PostgreSQL C-style escaped hexadecimal byte + value. See for details. -- 2.27.0