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

Function ExecSetVariableStmt

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

* SET command */

Source from the content-addressed store, hash-verified

9050 * SET command
9051 */
9052void
9053ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel)
9054{
9055 GucAction action = stmt->is_local ? GUC_ACTION_LOCAL : GUC_ACTION_SET;
9056
9057 /*
9058 * Workers synchronize these parameters at the start of the parallel
9059 * operation; then, we block SET during the operation.
9060 */
9061 if (IsInParallelMode())
9062 ereport(ERROR,
9063 (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
9064 errmsg("cannot set parameters during a parallel operation")));
9065
9066 switch (stmt->kind)
9067 {
9068 case VAR_SET_VALUE:
9069 case VAR_SET_CURRENT:
9070 if (stmt->is_local &&
9071 Gp_role != GP_ROLE_EXECUTE && !IsBootstrapProcessingMode())
9072 {
9073 WarnNoTransactionBlock(isTopLevel, "SET LOCAL");
9074 }
9075
9076 SIMPLE_FAULT_INJECTOR("set_variable_fault");
9077 (void) set_config_option(stmt->name,
9078 ExtractSetVariableArgs(stmt),
9079 (superuser() ? PGC_SUSET : PGC_USERSET),
9080 PGC_S_SESSION,
9081 action, true, 0, false);
9082 DispatchSetPGVariable(stmt->name, stmt->args, stmt->is_local);
9083 break;
9084 case VAR_SET_MULTI:
9085
9086 /*
9087 * Special-case SQL syntaxes. The TRANSACTION and SESSION
9088 * CHARACTERISTICS cases effectively set more than one variable
9089 * per statement. TRANSACTION SNAPSHOT only takes one argument,
9090 * but we put it here anyway since it's a special case and not
9091 * related to any GUC variable.
9092 */
9093 if (strcmp(stmt->name, "TRANSACTION") == 0)
9094 {
9095 ListCell *head;
9096
9097 if (Gp_role != GP_ROLE_EXECUTE)
9098 WarnNoTransactionBlock(isTopLevel, "SET TRANSACTION");
9099
9100 foreach(head, stmt->args)
9101 {
9102 DefElem *item = (DefElem *) lfirst(head);
9103
9104 if (strcmp(item->defname, "transaction_isolation") == 0)
9105 SetPGVariable("transaction_isolation",
9106 list_make1(item->arg), stmt->is_local);
9107 else if (strcmp(item->defname, "transaction_read_only") == 0)
9108 SetPGVariable("transaction_read_only",
9109 list_make1(item->arg), stmt->is_local);

Callers 1

standard_ProcessUtilityFunction · 0.85

Calls 15

IsInParallelModeFunction · 0.85
WarnNoTransactionBlockFunction · 0.85
set_config_optionFunction · 0.85
ExtractSetVariableArgsFunction · 0.85
superuserFunction · 0.85
DispatchSetPGVariableFunction · 0.85
SetPGVariableFunction · 0.85
ImportSnapshotFunction · 0.85
ResetAllOptionsFunction · 0.85
initStringInfoFunction · 0.85
appendStringInfoFunction · 0.85
CdbDispatchSetCommandFunction · 0.85

Tested by

no test coverage detected