multisql/executor/alter_table/
validate.rs

1use {
2	crate::{AlterError, Result},
3	sqlparser::ast::{ColumnDef, DataType},
4};
5
6pub fn validate(column_def: &ColumnDef) -> Result<()> {
7	let ColumnDef {
8		data_type,
9		options: _,
10		name: _,
11		..
12	} = column_def;
13
14	if !matches!(
15		data_type,
16		DataType::Boolean | DataType::Int(_) | DataType::Float(_) | DataType::Text
17	) {
18		return Err(AlterError::UnsupportedDataType(data_type.to_string()).into());
19	}
20
21	Ok(())
22}