Turn on GUC_REPORT flag for search_path to enable reporting back the parameter value upon change. (#6983)

DESCRIPTION: Turns on the GUC_REPORT flag for search_path. This results
in postgres to report the parameter status back in addition to Command
Complete packet.

In response to the following command,

> SET search_path TO client1;

postgres sends back the following packets (shown in pseudo form):

C (Command Complete) SET + **S (Parameter Status) search_path =
client1**
pull/7006/head
Emel Şimşek 2023-06-14 17:35:52 +03:00 committed by GitHub
parent 3cc7a4aa42
commit 4f793abc4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 5 deletions

View File

@ -191,7 +191,7 @@ static void CitusCleanupConnectionsAtExit(int code, Datum arg);
static void DecrementExternalClientBackendCounterAtExit(int code, Datum arg);
static void CreateRequiredDirectories(void);
static void RegisterCitusConfigVariables(void);
static void OverridePostgresConfigAssignHooks(void);
static void OverridePostgresConfigProperties(void);
static bool ErrorIfNotASuitableDeadlockFactor(double *newval, void **extra,
GucSource source);
static bool WarnIfDeprecatedExecutorUsed(int *newval, void **extra, GucSource source);
@ -2587,16 +2587,17 @@ RegisterCitusConfigVariables(void)
/* warn about config items in the citus namespace that are not registered above */
EmitWarningsOnPlaceholders("citus");
OverridePostgresConfigAssignHooks();
OverridePostgresConfigProperties();
}
/*
* OverridePostgresConfigAssignHooks overrides GUC assign hooks where we want
* custom behaviour.
* OverridePostgresConfigProperties overrides GUC properties where we want
* custom behaviour. We should consider using Postgres function find_option
* in this function once it is exported by Postgres in a later release.
*/
static void
OverridePostgresConfigAssignHooks(void)
OverridePostgresConfigProperties(void)
{
struct config_generic **guc_vars = get_guc_variables();
int gucCount = GetNumConfigOptions();
@ -2612,6 +2613,17 @@ OverridePostgresConfigAssignHooks(void)
OldApplicationNameAssignHook = stringVar->assign_hook;
stringVar->assign_hook = ApplicationNameAssignHook;
}
/*
* Turn on GUC_REPORT for search_path. GUC_REPORT provides that an S (Parameter Status)
* packet is appended after the C (Command Complete) packet sent from the server
* for SET command. S packet contains the new value of the parameter
* if its value has been changed.
*/
if (strcmp(var->name, "search_path") == 0)
{
var->flags |= GUC_REPORT;
}
}
}