From ec681060a845646c73df40110fe06823d948fc57 Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Thu, 9 Mar 2017 15:10:37 +0100 Subject: [PATCH] db/view: Replace entry if cells don't match If a base table regular columns is part of the view's pk, and if that column changes, we should replace the entry, by deleting the row(s) with the old value and inserting a new one. Signed-off-by: Duarte Nunes --- db/view/view.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/view/view.cc b/db/view/view.cc index d351028ee7..d44c27c4aa 100644 --- a/db/view/view.cc +++ b/db/view/view.cc @@ -425,9 +425,9 @@ void view_updates::generate_update( // Note: multi-cell columns can't be part of the primary key. auto cmp = compare_atomic_cell_for_merge(before->as_atomic_cell(), after->as_atomic_cell()); if (cmp == 0) { - replace_entry(base_key, update, *existing, now); - } else { update_entry(base_key, update, *existing, now); + } else { + replace_entry(base_key, update, *existing, now); } } else { delete_old_entry(base_key, *existing, now);