MCPcopy Create free account
hub / github.com/apache/cloudberry / DispatchSetPGVariable

Function DispatchSetPGVariable

src/backend/utils/misc/guc.c:9252–9346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9250}
9251
9252static void
9253DispatchSetPGVariable(const char *name, List *args, bool is_local)
9254{
9255 ListCell *l;
9256 StringInfoData buffer;
9257
9258 if (Gp_role != GP_ROLE_DISPATCH || IsBootstrapProcessingMode())
9259 return;
9260
9261 /*
9262 * client_encoding is always kept at SQL_ASCII in QE processes. (See also
9263 * cdbconn_doConnectStart().)
9264 */
9265 if (strcmp(name, "client_encoding") == 0)
9266 return;
9267
9268 initStringInfo( &buffer );
9269
9270 if (args == NIL)
9271 {
9272 appendStringInfo(&buffer, "RESET %s", name);
9273 }
9274 else
9275 {
9276 appendStringInfo(&buffer, "SET ");
9277 if (is_local)
9278 appendStringInfo(&buffer, "LOCAL ");
9279
9280 appendStringInfo(&buffer, "%s TO ", quote_identifier(name));
9281
9282 /*
9283 * GPDB: We handle the timezone GUC specially. This is because the
9284 * timezone GUC can be set with the SET TIME ZONE .. syntax which is an
9285 * alias for SET timezone. Instead of dispatching the SET TIME ZONE ..
9286 * as a special case, we dispatch the already set time zone from the QD
9287 * with the usual SET syntax flavor (SET timezone TO <>).
9288 * Please refer to Issue: #9055 for additional detail.
9289 * #9055 - https://github.com/greenplum-db/gpdb/issues/9055
9290 */
9291 if (strcmp(name, "timezone") == 0)
9292 appendStringInfo(&buffer, "%s",
9293 quote_literal_cstr(GetConfigOptionByName("timezone",
9294 NULL,
9295 false)));
9296 else
9297 {
9298 foreach(l, args)
9299 {
9300 Node *arg = (Node *) lfirst(l);
9301 char *val;
9302 A_Const *con;
9303
9304 if (l != list_head(args))
9305 appendStringInfo(&buffer, ", ");
9306
9307 if (IsA(arg, TypeCast))
9308 {
9309 TypeCast *tc = (TypeCast *) arg;

Callers 2

ExecSetVariableStmtFunction · 0.85
SetPGVariableOptDispatchFunction · 0.85

Calls 9

initStringInfoFunction · 0.85
appendStringInfoFunction · 0.85
quote_literal_cstrFunction · 0.85
GetConfigOptionByNameFunction · 0.85
list_headFunction · 0.85
appendStringInfoStringFunction · 0.85
CdbDispatchSetCommandFunction · 0.85
quote_identifierFunction · 0.50
foreachFunction · 0.50

Tested by

no test coverage detected