Skip to content

Commit

Permalink
Merge pull request #81 from Mytherin/constraintdef
Browse files Browse the repository at this point in the history
Correctly define unique constraint in SQLite table definition
  • Loading branch information
Mytherin authored Jan 23, 2024
2 parents aa9be09 + e3c2a7f commit 9b558ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sqlite_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ void SQLiteDB::GetTableInfo(const string &table_name, ColumnList &columns, vecto
StringUtil::Trim(sqlite_type);
auto column_type = all_varchar ? LogicalType::VARCHAR : SQLiteUtils::TypeToLogicalType(sqlite_type);

if (pk) {
primary_key_index = cid;
primary_keys.push_back(sqlite_colname);
}
ColumnDefinition column(std::move(sqlite_colname), std::move(column_type));
if (!default_value.empty() && default_value != "\"\"") {
auto expressions = Parser::ParseExpressionList(default_value);
Expand All @@ -178,10 +182,6 @@ void SQLiteDB::GetTableInfo(const string &table_name, ColumnList &columns, vecto
if (not_null) {
constraints.push_back(make_uniq<NotNullConstraint>(LogicalIndex(cid)));
}
if (pk) {
primary_key_index = cid;
primary_keys.push_back(sqlite_colname);
}
found = true;
}
if (!found) {
Expand Down

0 comments on commit 9b558ed

Please sign in to comment.