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

Function plan_insert

src/sql/src/plan/statement/dml.rs:95–122  ·  view source on GitHub ↗
(
    scx: &StatementContext,
    InsertStatement {
        table_name,
        columns,
        source,
        returning,
    }: InsertStatement<Aug>,
    params: &Params,
)

Source from the content-addressed store, hash-verified

93}
94
95pub fn plan_insert(
96 scx: &StatementContext,
97 InsertStatement {
98 table_name,
99 columns,
100 source,
101 returning,
102 }: InsertStatement<Aug>,
103 params: &Params,
104) -> Result<Plan, PlanError> {
105 let (id, mut expr, returning) =
106 query::plan_insert_query(scx, table_name, columns, source, returning)?;
107 expr.bind_parameters_and_simplify_offset(scx, QueryLifetime::OneShot, params)?;
108 let returning = returning
109 .expr
110 .into_iter()
111 .map(|mut expr| {
112 expr.bind_parameters_and_simplify_offset(scx, QueryLifetime::OneShot, params)?;
113 expr.lower_uncorrelated(scx.catalog.system_vars())
114 })
115 .collect::<Result<Vec<_>, _>>()?;
116
117 Ok(Plan::Insert(InsertPlan {
118 id,
119 values: expr,
120 returning,
121 }))
122}
123
124pub fn describe_delete(
125 scx: &StatementContext,

Callers 1

planFunction · 0.85

Calls 7

plan_insert_queryFunction · 0.85
lower_uncorrelatedMethod · 0.80
InsertClass · 0.50
mapMethod · 0.45
into_iterMethod · 0.45
system_varsMethod · 0.45

Tested by

no test coverage detected