From 38183d3b3bf45e2f5066ace2b40d0d96b3f074de Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Tue, 15 Jul 2025 18:42:27 +0300 Subject: [PATCH] tcl: add regression test for large text keys --- testing/insert.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/testing/insert.test b/testing/insert.test index 6a5027d25..5ddd09c9e 100755 --- a/testing/insert.test +++ b/testing/insert.test @@ -393,3 +393,20 @@ do_execsql_test_on_specific_db {:memory:} rowid-overflow-random-generation { INSERT INTO q(y) VALUES (3); SELECT COUNT(*) FROM q; } {3} + +# regression test for incorrect processing of record header in the case of large text columns +if {[info exists ::env(SQLITE_EXEC)] && ($::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental" || $::env(SQLITE_EXEC) eq "sqlite3")} { + do_execsql_test_on_specific_db {:memory:} large-text-index-seek { + CREATE TABLE t(x TEXT, y); + CREATE INDEX t_idx ON t(x); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'a', 1); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'b', 2); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'c', 3); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'd', 4); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'e', 5); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'f', 6); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'g', 7); + INSERT INTO t VALUES (replace(hex(zeroblob(1000)), '00', 'a') || 'h', 8); + SELECT COUNT(*) FROM t WHERE x >= replace(hex(zeroblob(100)), '00', 'a'); + } {8} +} \ No newline at end of file