re-enable tests that work with indexes

This commit is contained in:
Pere Diaz Bou 2025-06-16 16:34:15 +02:00
parent bcbce15d7b
commit 63b37ea6f2
5 changed files with 61 additions and 41 deletions

View file

@ -128,6 +128,8 @@ do_execsql_test select-agg-json-array-object {
SELECT json_group_array(json_object('name', name)) FROM products;
} {[{"name":"hat"},{"name":"cap"},{"name":"shirt"},{"name":"sweater"},{"name":"sweatshirt"},{"name":"shorts"},{"name":"jeans"},{"name":"sneakers"},{"name":"boots"},{"name":"coat"},{"name":"accessories"}]}
do_execsql_test select-distinct-agg-functions {
SELECT sum(distinct age), count(distinct age), avg(distinct age) FROM users;
} {5050|100|50.5}
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test select-distinct-agg-functions {
SELECT sum(distinct age), count(distinct age), avg(distinct age) FROM users;
} {5050|100|50.5}
}

View file

@ -199,14 +199,16 @@ do_execsql_test group_by_no_sorting_required {
2|113
3|97}
do_execsql_test distinct_agg_functions {
select first_name, sum(distinct age), count(distinct age), avg(distinct age)
from users
group by 1
limit 3;
} {Aaron|1769|33|53.6060606060606
Abigail|833|15|55.5333333333333
Adam|1517|30|50.5666666666667}
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test distinct_agg_functions {
select first_name, sum(distinct age), count(distinct age), avg(distinct age)
from users
group by 1
limit 3;
} {Aaron|1769|33|53.6060606060606
Abigail|833|15|55.5333333333333
Adam|1517|30|50.5666666666667}
}
do_execsql_test_on_specific_db {:memory:} having_or {
CREATE TABLE users (first_name TEXT, age INTEGER);

View file

@ -324,15 +324,17 @@ do_execsql_test_on_specific_db {:memory:} insert_from_select_same_table_2 {
5|2|200
6|3|300}
do_execsql_test_on_specific_db {:memory:} insert_from_select_union {
CREATE TABLE t(a, b);
CREATE TABLE t2(b, c);
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test_on_specific_db {:memory:} insert_from_select_union {
CREATE TABLE t(a, b);
CREATE TABLE t2(b, c);
INSERT INTO t2 VALUES (1, 100), (2, 200);
INSERT INTO t SELECT * FROM t UNION SELECT * FROM t2;
SELECT * FROM t;
} {1|100
2|200}
INSERT INTO t2 VALUES (1, 100), (2, 200);
INSERT INTO t SELECT * FROM t UNION SELECT * FROM t2;
SELECT * FROM t;
} {1|100
2|200}
}
do_execsql_test_on_specific_db {:memory:} negative-primary-integer-key {
CREATE TABLE t(a INTEGER PRIMARY KEY);

View file

@ -228,11 +228,21 @@ do_execsql_test left-join-constant-condition-true-inner-join-constant-condition-
select u.first_name, p.name, u2.first_name from users u left join products as p on 1 join users u2 on 0 limit 5;
} {}
#do_execsql_test join-utilizing-both-seekrowid-and-secondary-index {
# select u.first_name, p.name from users u join products p on u.id = p.id and u.age > 70;
#} {Matthew|boots
#Nicholas|shorts
#Jamie|hat}
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test join-utilizing-both-seekrowid-and-secondary-index {
select u.first_name, p.name from users u join products p on u.id = p.id and u.age > 70;
} {Matthew|boots
Nicholas|shorts
Jamie|hat}
} else {
# without index experimental the order is different since we don't use indexes
do_execsql_test join-utilizing-both-seekrowid-and-secondary-index {
select u.first_name, p.name from users u join products p on u.id = p.id and u.age > 70;
} {Jamie|hat
Nicholas|shorts
Matthew|boots}
}
# important difference between regular SELECT * join and a SELECT * USING join is that the join keys are deduplicated
# from the result in the USING case.

View file

@ -142,11 +142,13 @@ do_execsql_test case-insensitive-alias {
select u.first_name as fF, count(1) > 0 as cC from users u where fF = 'Jamie' group by fF order by cC;
} {Jamie|1}
#do_execsql_test age_idx_order_desc {
# select first_name from users order by age desc limit 3;
#} {Robert
#Sydney
#Matthew}
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test age_idx_order_desc {
select first_name from users order by age desc limit 3;
} {Robert
Sydney
Matthew}
}
do_execsql_test rowid_or_integer_pk_desc {
select first_name from users order by id desc limit 3;
@ -163,19 +165,21 @@ do_execsql_test orderby_desc_verify_rows {
select count(1) from (select * from users order by age desc)
} {10000}
#do_execsql_test orderby_desc_with_offset {
# select first_name, age from users order by age desc limit 3 offset 666;
#} {Francis|94
#Matthew|94
#Theresa|94}
if {[info exists ::env(SQLITE_EXEC)] && $::env(SQLITE_EXEC) eq "scripts/limbo-sqlite3-index-experimental"} {
do_execsql_test orderby_desc_with_offset {
select first_name, age from users order by age desc limit 3 offset 666;
} {Francis|94
Matthew|94
Theresa|94}
#do_execsql_test orderby_desc_with_filter {
# select first_name, age from users where age <= 50 order by age desc limit 5;
#} {Gerald|50
#Nicole|50
#Tammy|50
#Marissa|50
#Daniel|50}
do_execsql_test orderby_desc_with_filter {
select first_name, age from users where age <= 50 order by age desc limit 5;
} {Gerald|50
Nicole|50
Tammy|50
Marissa|50
Daniel|50}
}
do_execsql_test orderby_asc_with_filter_range {
select first_name, age from users where age <= 50 and age >= 49 order by age asc limit 5;