From 59ed94ad0c9f74a3f057f359316c845cedc4461e Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 2 Dec 2009 04:54:10 +0000 Subject: [PATCH] Mark application_name as GUC_REPORT so that the value will be reported back to the client by the server. This might seem pretty pointless but apparently it will help pgbouncer, and perhaps other connection poolers. Anyway it's practically free to do so for the normal use-case where appname is only set in the startup packet --- we're just adding a few more bytes to the initial ParameterStatus response packet. Per comments from Marko Kreen. --- doc/src/sgml/libpq.sgml | 8 +++++--- doc/src/sgml/protocol.sgml | 8 +++++--- src/backend/utils/misc/guc.c | 4 ++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index b93e381b1e6..95c903378ca 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,4 +1,4 @@ - + <application>libpq</application> - C Library @@ -1167,6 +1167,7 @@ PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg); server_version, server_encoding, client_encoding, + application_name, is_superuser, session_authorization, DateStyle, @@ -1177,8 +1178,9 @@ PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg); (server_encoding, TimeZone, and integer_datetimes were not reported by releases before 8.0; standard_conforming_strings was not reported by releases - before 8.1; IntervalStyle was not reported by releases - before 8.4.) + before 8.1; + IntervalStyle was not reported by releases before 8.4; + application_name was not reported by releases before 8.5.) Note that server_version, server_encoding and diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index 3b115fec430..1ec079e41c8 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -1,4 +1,4 @@ - + Frontend/Backend Protocol @@ -1088,6 +1088,7 @@ server_version, server_encoding, client_encoding, + application_name, is_superuser, session_authorization, DateStyle, @@ -1098,8 +1099,9 @@ (server_encoding, TimeZone, and integer_datetimes were not reported by releases before 8.0; standard_conforming_strings was not reported by releases - before 8.1; IntervalStyle was not reported by releases - before 8.4.) + before 8.1; + IntervalStyle was not reported by releases before 8.4; + application_name was not reported by releases before 8.5.) Note that server_version, server_encoding and diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 04ba14c2dbb..f5db7783f19 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -10,7 +10,7 @@ * Written by Peter Eisentraut . * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.524 2009/11/28 23:38:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.525 2009/12/02 04:54:10 tgl Exp $ * *-------------------------------------------------------------------- */ @@ -2541,7 +2541,7 @@ static struct config_string ConfigureNamesString[] = {"application_name", PGC_USERSET, LOGGING, gettext_noop("Sets the application name to be reported in statistics and logs."), NULL, - GUC_IS_NAME | GUC_NOT_IN_SAMPLE + GUC_IS_NAME | GUC_REPORT | GUC_NOT_IN_SAMPLE }, &application_name, "", assign_application_name, NULL -- 2.39.5