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

Function plan_create_sink

src/sql/src/plan/statement/ddl.rs:3193–3212  ·  view source on GitHub ↗
(
    scx: &StatementContext,
    stmt: CreateSinkStatement<Aug>,
)

Source from the content-addressed store, hash-verified

3191);
3192
3193pub fn plan_create_sink(
3194 scx: &StatementContext,
3195 stmt: CreateSinkStatement<Aug>,
3196) -> Result<Plan, PlanError> {
3197 // Check for an object in the catalog with this same name
3198 let Some(name) = stmt.name.clone() else {
3199 return Err(PlanError::MissingName(CatalogItemType::Sink));
3200 };
3201 let name = scx.allocate_qualified_name(normalize::unresolved_item_name(name)?)?;
3202 let full_name = scx.catalog.resolve_full_name(&name);
3203 let partial_name = PartialItemName::from(full_name.clone());
3204 if let (false, Ok(item)) = (stmt.if_not_exists, scx.catalog.resolve_item(&partial_name)) {
3205 return Err(PlanError::ItemAlreadyExists {
3206 name: full_name.to_string(),
3207 item_type: item.item_type(),
3208 });
3209 }
3210
3211 plan_sink(scx, stmt)
3212}
3213
3214/// This function will plan a sink as if it does not exist in the catalog. This is so the planning
3215/// logic is reused by both CREATE SINK and ALTER SINK planning. It is the responsibility of the

Callers 2

planFunction · 0.85
plan_explain_schemaFunction · 0.85

Calls 8

unresolved_item_nameFunction · 0.85
plan_sinkFunction · 0.85
cloneMethod · 0.45
resolve_full_nameMethod · 0.45
resolve_itemMethod · 0.45
to_stringMethod · 0.45
item_typeMethod · 0.45

Tested by

no test coverage detected