Skip to content

Commit

Permalink
add constraints
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Jan 3, 2025
1 parent 15371b8 commit 5a21eb2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/frontend/src/catalog/purify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,20 @@ pub fn try_purify_table_create_sql_ast(
columns: pk_columns,
is_primary: true,
};

// We don't support table constraints other than `PRIMARY KEY`, thus simply overwrite.
assert!(
constraints.len() <= 1
&& constraints.iter().all(|c| matches!(
c,
TableConstraint::Unique {
is_primary: true,
..
}
)),
"unexpected table constraints: {constraints:?}",
);

*constraints = vec![pk_constraint];
}

Expand Down

0 comments on commit 5a21eb2

Please sign in to comment.