Report search_path value back to the client. - Mailing list pgsql-hackers

From Alexander Kukushkin
Subject Report search_path value back to the client.
Date
Msg-id CAFh8B=k8s7WrcqhafmYhdN1+E5LVzZi_QaYDq8bKvrGJTAhY2Q@mail.gmail.com
Whole thread Raw
Responses Re: Report search_path value back to the client.  (Alexey Klyukin <alexk@hintbits.com>)
List pgsql-hackers
Hi,

As of now postgres is reporting only "really" important variables, but among them
there are also not so important, like 'application_name'. The only reason to report
it, was: "help pgbouncer, and perhaps other connection poolers".
Change was introduced by commit: 59ed94ad0c9f74a3f057f359316c845cedc4461e

This fact makes me wonder, why 'search_path' value is not reported back to the
client? Use-case is absolutely the same as with 'application_name' but a little bit
more important.

Our databases provides different version of stored procedures which are located
in a different schemas: 'api_version1', 'api_version2', 'api_version5', etc...
When application establish connection to the database it set search_path value
for example to api_version1. At the same time, new version of the same application
will set search_path value to api_version2. Sometimes we have hundreds of
instances of applications which may use different versions of stored procedures
which are located in different schemas.

It's really crazy to keep so many (hundreds) connections to the database and
it would be much better to have something like pgbouncer in front of postgres.
Right now it's not possible, because pgbouncer is not aware of search_path
and it's not really possible to fix pgbouncer, because there is no easy way to
get current value of search_path.

I would like to mark 'search_path' as GUC_REPORT:
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -2904,7 +2904,7 @@ static struct config_string ConfigureNamesString[] =
                {"search_path", PGC_USERSET, CLIENT_CONN_STATEMENT,
                        gettext_noop("Sets the schema search order for names that are not schema-qualified."),
                        NULL,
-                       GUC_LIST_INPUT | GUC_LIST_QUOTE
+                       GUC_LIST_INPUT | GUC_LIST_QUOTE | GUC_REPORT
                },
                &namespace_search_path,
                "\"$user\",public",

What do you think?

Regards,
--
Alexander Kukushkin

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: why is PG_AUTOCONF_FILENAME is pg_config_manual.h?
Next
From: Robert Haas
Date:
Subject: Re: [REVIEW] Re: Compression of full-page-writes