postgres_fdw: Allow postgres_fdw.application_name to include escape sequences

Enterprise / PostgreSQL - Fujii Masao [] - 24 December 2021 07:55 UTC

application_name that used when postgres_fdw establishes a connection to a foreign server can be specified in either or both a connection parameter of a server object and GUC postgres_fdw.application_name. This commit allows those parameters to include escape sequences that begins with % character. Then postgres_fdw replaces those escape sequences with status information. For example, %d and %u are replaced with user name and database name in local server, respectively. This feature enables us to add information more easily to track remote transactions or queries, into application_name of a remote connection.

Author: Hayato Kuroda

6e0cb3dec1 postgres_fdw: Allow postgres_fdw.application_name to include escape sequences.
contrib/postgres_fdw/connection.c | 36 ++++++++++++++
contrib/postgres_fdw/expected/postgres_fdw.out | 32 ++++++++++++
contrib/postgres_fdw/option.c | 62 ++++++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.h | 1 +
contrib/postgres_fdw/sql/postgres_fdw.sql | 21 ++++++++
doc/src/sgml/postgres-fdw.sgml | 67 +++++++++++++++++++++++++-
6 files changed, 218 insertions(+), 1 deletion(-)


  • Share