From 95661c13bcf3fb5576b80d3afe9b760e508ccf41 Mon Sep 17 00:00:00 2001 From: Antonio Andelic Date: Mon, 3 Apr 2023 09:55:11 +0000 Subject: [PATCH] Add tests for strict update/delete --- ..._keeper_map_delete_update_strict.reference | 32 ++++++++++++++ .../02707_keeper_map_delete_update_strict.sql | 44 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/queries/0_stateless/02707_keeper_map_delete_update_strict.reference create mode 100644 tests/queries/0_stateless/02707_keeper_map_delete_update_strict.sql diff --git a/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.reference b/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.reference new file mode 100644 index 00000000000..8ca8c0ca5a2 --- /dev/null +++ b/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.reference @@ -0,0 +1,32 @@ +1 Some string 0 +2 Some other string 0 +3 random 0 +4 random2 0 +----------- +3 random 0 +4 random2 0 +----------- +3 random 0 +----------- +0 +----------- +1 String 10 +2 String 20 +3 String 30 +4 String 40 +----------- +1 String 10 +2 String 20 +3 Another 30 +4 Another 40 +----------- +1 String 10 +2 String 20 +3 Another 30 +4 Another 40 +----------- +1 String 102 +2 String 202 +3 Another 302 +4 Another 402 +----------- diff --git a/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.sql b/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.sql new file mode 100644 index 00000000000..1e14675d353 --- /dev/null +++ b/tests/queries/0_stateless/02707_keeper_map_delete_update_strict.sql @@ -0,0 +1,44 @@ +-- Tags: no-ordinary-database, no-fasttest + +DROP TABLE IF EXISTS 02661_keepermap_delete_update; + +SET keeper_map_strict_mode = 1; + +CREATE TABLE 02661_keepermap_delete_update (key UInt64, value String, value2 UInt64) ENGINE=KeeperMap('/' || currentDatabase() || '/test02661_keepermap_delete_update') PRIMARY KEY(key); + +INSERT INTO 02661_keepermap_delete_update VALUES (1, 'Some string', 0), (2, 'Some other string', 0), (3, 'random', 0), (4, 'random2', 0); + +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +DELETE FROM 02661_keepermap_delete_update WHERE value LIKE 'Some%string'; + +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +ALTER TABLE 02661_keepermap_delete_update DELETE WHERE key >= 4; + +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +DELETE FROM 02661_keepermap_delete_update WHERE 1 = 1; +SELECT count() FROM 02661_keepermap_delete_update; +SELECT '-----------'; + +INSERT INTO 02661_keepermap_delete_update VALUES (1, 'String', 10), (2, 'String', 20), (3, 'String', 30), (4, 'String', 40); +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +ALTER TABLE 02661_keepermap_delete_update UPDATE value = 'Another' WHERE key > 2; +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +ALTER TABLE 02661_keepermap_delete_update UPDATE key = key * 10 WHERE 1 = 1; -- { serverError 36 } +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +ALTER TABLE 02661_keepermap_delete_update UPDATE value2 = value2 * 10 + 2 WHERE value2 < 100; +SELECT * FROM 02661_keepermap_delete_update ORDER BY key; +SELECT '-----------'; + +DROP TABLE IF EXISTS 02661_keepermap_delete_update;