1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

When reading sqlite_stat4 data during query planning, be sure to expand

zeroblobs prior to running comparisons.  Fix for the issue identified
by [forum:/forumpost/5275207102|forum post 5275207102].

FossilOrigin-Name: 5c8dd8dfcaab9c364b3a126ca35880ef57f5cecbe030771e646c934c8cf43709
This commit is contained in:
drh
2023-03-25 22:37:23 +00:00
parent 28ae195658
commit 7bb842642c
4 changed files with 24 additions and 9 deletions

View File

@ -275,6 +275,20 @@ do_execsql_test analyzeE-6.4 {
SELECT count(*) FROM sqlite_stat4 WHERE idx='i1' AND neq<>'1 1 1 1 1 1';
} 0
# 2023-03-25 https://sqlite.org/forum/forumpost/5275207102
# Correctly expand zeroblobs while processing STAT4 information
# during query planning.
#
reset_db
do_execsql_test analyzeE-7.0 {
CREATE TABLE t1(a TEXT COLLATE binary);
CREATE INDEX t1x ON t1(a);
INSERT INTO t1(a) VALUES(0),('apple'),(NULL),(''),('banana');
ANALYZE;
SELECT format('(%s)',a) FROM t1 WHERE t1.a > CAST(zeroblob(5) AS TEXT);
} {(0) (apple) (banana)}
do_execsql_test analyzeE-7.1 {
SELECT format('(%s)',a) FROM t1 WHERE t1.a <= CAST(zeroblob(5) AS TEXT);
} {()}
finish_test