(
scx: &StatementContext,
SetVariableStatement {
local,
variable,
to,
}: SetVariableStatement,
)
| 41 | } |
| 42 | |
| 43 | pub fn plan_set_variable( |
| 44 | scx: &StatementContext, |
| 45 | SetVariableStatement { |
| 46 | local, |
| 47 | variable, |
| 48 | to, |
| 49 | }: SetVariableStatement, |
| 50 | ) -> Result<Plan, PlanError> { |
| 51 | let value = plan_set_variable_to(to)?; |
| 52 | let name = variable.into_string(); |
| 53 | |
| 54 | // Gate feature-flagged isolation levels at plan time. The same check runs in |
| 55 | // `SessionVars::set`, which also covers `ALTER ROLE ... SET` and connection |
| 56 | // options; running it here too surfaces the error before sequencing. |
| 57 | if let VariableValue::Values(values) = &value { |
| 58 | vars::check_transaction_isolation_feature_flag( |
| 59 | &name, |
| 60 | VarInput::SqlSet(values), |
| 61 | scx.catalog.system_vars(), |
| 62 | )?; |
| 63 | } |
| 64 | |
| 65 | Ok(Plan::SetVariable(SetVariablePlan { name, value, local })) |
| 66 | } |
| 67 | |
| 68 | pub fn plan_set_variable_to(to: SetVariableTo) -> Result<VariableValue, PlanError> { |
| 69 | match to { |
no test coverage detected