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.
This commit is contained in:
Tom Lane 2009-12-02 04:54:10 +00:00
parent 3dfcf8cc15
commit 59ed94ad0c
3 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.290 2009/11/28 23:38:06 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.291 2009/12/02 04:54:10 tgl Exp $ -->
<chapter id="libpq">
<title><application>libpq</application> - C Library</title>
@ -1167,6 +1167,7 @@ PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
<literal>server_version</>,
<literal>server_encoding</>,
<literal>client_encoding</>,
<literal>application_name</>,
<literal>is_superuser</>,
<literal>session_authorization</>,
<literal>DateStyle</>,
@ -1177,8 +1178,9 @@ PQconninfoOption *PQconninfoParse(const char *conninfo, char **errmsg);
(<literal>server_encoding</>, <literal>TimeZone</>, and
<literal>integer_datetimes</> were not reported by releases before 8.0;
<literal>standard_conforming_strings</> was not reported by releases
before 8.1; <literal>IntervalStyle</> was not reported by releases
before 8.4.)
before 8.1;
<literal>IntervalStyle</> was not reported by releases before 8.4;
<literal>application_name</> was not reported by releases before 8.5.)
Note that
<literal>server_version</>,
<literal>server_encoding</> and

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.75 2008/11/09 00:28:34 tgl Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.76 2009/12/02 04:54:10 tgl Exp $ -->
<chapter id="protocol">
<title>Frontend/Backend Protocol</title>
@ -1088,6 +1088,7 @@
<literal>server_version</>,
<literal>server_encoding</>,
<literal>client_encoding</>,
<literal>application_name</>,
<literal>is_superuser</>,
<literal>session_authorization</>,
<literal>DateStyle</>,
@ -1098,8 +1099,9 @@
(<literal>server_encoding</>, <literal>TimeZone</>, and
<literal>integer_datetimes</> were not reported by releases before 8.0;
<literal>standard_conforming_strings</> was not reported by releases
before 8.1; <literal>IntervalStyle</> was not reported by releases
before 8.4.)
before 8.1;
<literal>IntervalStyle</> was not reported by releases before 8.4;
<literal>application_name</> was not reported by releases before 8.5.)
Note that
<literal>server_version</>,
<literal>server_encoding</> and

View File

@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* 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