don't allow duplicate columns and get column type more precisely

This commit is contained in:
Pavan-Nambi
2025-09-22 16:24:22 +05:30
parent 25754cb0e4
commit 8dc485e5f7
2 changed files with 8 additions and 1 deletions

View File

@@ -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");

View File

@@ -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());