MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / plan_set_variable

Function plan_set_variable

src/sql/src/plan/statement/scl.rs:43–66  ·  view source on GitHub ↗
(
    scx: &StatementContext,
    SetVariableStatement {
        local,
        variable,
        to,
    }: SetVariableStatement,
)

Source from the content-addressed store, hash-verified

41}
42
43pub 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
68pub fn plan_set_variable_to(to: SetVariableTo) -> Result<VariableValue, PlanError> {
69 match to {

Callers 1

planFunction · 0.85

Calls 5

plan_set_variable_toFunction · 0.85
SqlSetClass · 0.50
into_stringMethod · 0.45
system_varsMethod · 0.45

Tested by

no test coverage detected