some code refactoring
This commit is contained in:
10
usql_ddl.cpp
10
usql_ddl.cpp
@@ -27,15 +27,7 @@ std::unique_ptr<Table> USql::execute_create_index(const CreateIndexNode &node) {
|
||||
if (col_def.null) throw Exception("index on not null supported only");
|
||||
if (table_def->get_index_for_column(node.column_name) != nullptr) throw Exception("column is already indexed");
|
||||
|
||||
IndexedDataType type;
|
||||
if (col_def.type == ColumnType::integer_type)
|
||||
type = IndexedDataType::integer;
|
||||
else if (col_def.type == ColumnType::varchar_type)
|
||||
type = IndexedDataType::string;
|
||||
else
|
||||
throw Exception("creating index on unsupported type");
|
||||
|
||||
table_def->create_index({node.index_name, node.column_name, type});
|
||||
table_def->create_index({node.index_name, node.column_name, col_def.type});
|
||||
|
||||
table_def->index_rows(node.index_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user