1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

postgres_fdw: Make postgres_fdw.application_name support more escape sequences.

Commit 6e0cb3dec1 allowed postgres_fdw.application_name to include
escape sequences %a (application name), %d (database name), %u (user name)
and %p (pid). In addition to them, this commit makes it support
the escape sequences for session ID (%c) and cluster name (%C).
These are helpful to investigate where each remote transactions came from.

Author: Fujii Masao
Reviewed-by: Ryohei Takahashi, Kyotaro Horiguchi
Discussion: https://postgr.es/m/1041dc9a-c976-049f-9f14-e7d94c29c4b2@oss.nttdata.com
This commit is contained in:
Fujii Masao
2022-02-18 11:38:12 +09:00
parent c476f380e2
commit 94c49d5340
5 changed files with 52 additions and 1 deletions

View File

@ -489,6 +489,12 @@ process_pgfdw_appname(const char *appname)
case 'a':
appendStringInfoString(&buf, application_name);
break;
case 'c':
appendStringInfo(&buf, "%lx.%x", (long) (MyStartTime), MyProcPid);
break;
case 'C':
appendStringInfoString(&buf, cluster_name);
break;
case 'd':
appendStringInfoString(&buf, MyProcPort->database_name);
break;