* SET command */
| 9050 | * SET command |
| 9051 | */ |
| 9052 | void |
| 9053 | ExecSetVariableStmt(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); |
no test coverage detected