From 0c87e17b4bbb0f67468635a46f855d66247a4841 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Sun, 27 Mar 2022 18:51:49 -0400 Subject: [PATCH] sql: regression test for MVCC timestamp in materialized views Before abeaf01db76933aa8801ed142d795d233a2dd175 this test would have failed, so this test will help make sure we don't regress. Release note: None --- pkg/sql/logictest/testdata/logic_test/materialized_view | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/sql/logictest/testdata/logic_test/materialized_view b/pkg/sql/logictest/testdata/logic_test/materialized_view index 8ea9435b7393..dce72acf3ef6 100644 --- a/pkg/sql/logictest/testdata/logic_test/materialized_view +++ b/pkg/sql/logictest/testdata/logic_test/materialized_view @@ -29,6 +29,9 @@ SELECT * FROM v 3 4 5 6 +let $orig_crdb_timestamp +SELECT max(crdb_internal_mvcc_timestamp) FROM v + # Now refresh the view. statement ok REFRESH MATERIALIZED VIEW v @@ -42,6 +45,12 @@ SELECT * FROM v 5 6 7 8 +# Verify that crdb_internal_mvcc_timestamp is updated for all rows. +query I +SELECT count(*) FROM v WHERE crdb_internal_mvcc_timestamp > $orig_crdb_timestamp +---- +4 + # Now add an index to the view, and use it. statement ok CREATE INDEX i ON v (y)