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

Function key_constraint_err

src/sql/src/plan/statement/ddl.rs:3568–3588  ·  view source on GitHub ↗
(desc: &RelationDesc, user_keys: &[ColumnName])

Source from the content-addressed store, hash-verified

3566}
3567
3568fn key_constraint_err(desc: &RelationDesc, user_keys: &[ColumnName]) -> PlanError {
3569 let user_keys = user_keys.iter().map(|column| column.as_str()).join(", ");
3570
3571 let existing_keys = desc
3572 .typ()
3573 .keys
3574 .iter()
3575 .map(|key_columns| {
3576 key_columns
3577 .iter()
3578 .map(|col| desc.get_name(*col).as_str())
3579 .join(", ")
3580 })
3581 .join(", ");
3582
3583 sql_err!(
3584 "Key constraint ({}) conflicts with existing key ({})",
3585 user_keys,
3586 existing_keys
3587 )
3588}
3589
3590/// Creating this by hand instead of using generate_extracted_config! macro
3591/// because the macro doesn't support parameterized enums. See <https://github.com/MaterializeInc/database-issues/issues/6698>

Callers 1

plan_create_sourceFunction · 0.85

Calls 6

joinMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45
typMethod · 0.45
get_nameMethod · 0.45

Tested by

no test coverage detected