mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-03 16:34:19 +01:00
don't allow duplicate columns and get column type more precisely
This commit is contained in:
@@ -1294,7 +1294,7 @@ impl From<&ColumnDefinition> for Column {
|
||||
let ty_str = value
|
||||
.col_type
|
||||
.as_ref()
|
||||
.map(|t| t.name.to_string())
|
||||
.map(|t| t.to_string())
|
||||
.unwrap_or_default();
|
||||
|
||||
let hidden = ty_str.contains("HIDDEN");
|
||||
|
||||
@@ -207,6 +207,13 @@ pub fn translate_alter_table(
|
||||
}
|
||||
}
|
||||
|
||||
let new_column_name = column.name.as_ref().unwrap();
|
||||
if btree.get_column(new_column_name).is_some() {
|
||||
return Err(LimboError::ParseError(
|
||||
"duplicate column name: ".to_string() + new_column_name,
|
||||
));
|
||||
}
|
||||
|
||||
// TODO: All quoted ids will be quoted with `[]`, we should store some info from the parsed AST
|
||||
btree.columns.push(column.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user