Fix duplicate/old rows on indexes when overriding a row by ID

This commit is contained in:
Martchus 2024-03-08 19:04:58 +01:00
parent 8e6fe671f0
commit f7cdacd30d
1 changed files with 4 additions and 0 deletions

View File

@ -858,6 +858,10 @@ public:
if (!id) {
id = this->nextID();
flags = MDB_APPEND;
} else if constexpr (std::tuple_size_v<tuple_t>) {
if (auto existing = ElementType(); this->get(id, existing)) {
clearIndex(id, existing);
}
}
(*d_txn)->put(d_parent->d_main, id, serToString(t), flags);
d_parent->forEachIndex([&](auto &&i) { i.put(*d_txn, t, id); });