Skip to content

[BUG] Handle null version file name in query #4311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions go/pkg/sysdb/metastore/db/dao/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (s *collectionDb) UpdateLogPositionAndVersionInfo(
// expensive locking mechanism. Taking the lock as a caution for now.
result := s.db.Model(&dbmodel.Collection{}).
Clauses(clause.Locking{Strength: "UPDATE"}).
Where("id = ? AND version = ? AND version_file_name = ?",
Where("id = ? AND version = ? AND (version_file_name IS NULL OR version_file_name = ?)",
collectionID,
currentCollectionVersion,
currentVersionFileName).
Expand Down Expand Up @@ -451,7 +451,8 @@ func (s *collectionDb) UpdateVersionRelatedFields(collectionID, existingVersionF
}

result := s.db.Model(&dbmodel.Collection{}).
Where("id = ? AND version_file_name = ?", collectionID, existingVersionFileName).
Where("id = ? AND (version_file_name IS NULL OR version_file_name = ?)",
collectionID, existingVersionFileName).
Updates(updates)
if result.Error != nil {
return 0, result.Error
Expand Down
Loading