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

Fix byte-code register allocation in ANALYZE for STAT4 when there multiple

indexes with differing numbers of columns.
[forum:/forumpost/bc39e531e5|forum post bc39e531e5].

FossilOrigin-Name: 2bf5413dc2c19d5feb32e5b01aa9b990ec2f74f45f5ca0dca15215f8c9dbc9b9
This commit is contained in:
drh
2023-03-24 16:57:21 +00:00
parent c03dbc5a24
commit 28fe02cd51
4 changed files with 57 additions and 10 deletions

View File

@ -251,4 +251,30 @@ do_execsql_test analyzeE-5.0 {
SELECT * FROM t0 WHERE t0.c1 BETWEEN '' AND (ABS(''));
} {{}}
# 2023-03-24 https://sqlite.org/forum/forumpost/bc39e531e5
#
reset_db
do_execsql_test analyzeE-6.0 {
CREATE TABLE t1(x);
CREATE INDEX i1 ON t1(x,x,x,x,x||2);
CREATE INDEX i2 ON t1(1<2);
WITH RECURSIVE c(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM c WHERE x<1000)
INSERT INTO t1(x) SELECT x FROM c;
ANALYZE;
} {}
do_execsql_test analyzeE-6.1 {
SELECT count(*)>1 FROM sqlite_stat4 WHERE idx='i2' AND neq='1000 1';
} 1
do_execsql_test analyzeE-6.2 {
SELECT count(*) FROM sqlite_stat4 WHERE idx='i2' AND neq<>'1000 1';
} 0
do_execsql_test analyzeE-6.3 {
SELECT count(*)>1 FROM sqlite_stat4 WHERE idx='i1' AND neq='1 1 1 1 1 1';
} 1
do_execsql_test analyzeE-6.4 {
SELECT count(*) FROM sqlite_stat4 WHERE idx='i1' AND neq<>'1 1 1 1 1 1';
} 0
finish_test