Files
chaisql/sqltests/planning/precalculate.sql
T
Asdine El Hrychy 613ca304f4 remove rowid
2025-09-07 23:29:43 +08:00

27 lines
577 B
SQL

-- setup:
CREATE table test(pk int primary key, a int);
-- test: precalculate constant
EXPLAIN SELECT * FROM test WHERE 3 + 4 > a + 3 % 2;
/* result:
{
plan: "table.Scan(\"test\") | rows.Filter(7 > a + 1)"
}
*/
-- test: precalculate BETWEEEN with path
EXPLAIN SELECT * FROM test WHERE 4 + 3 + a BETWEEN 3 + 6 AND 5 * 10;
/* result:
{
plan: "table.Scan(\"test\") | rows.Filter(7 + a BETWEEN 9 AND 50)"
}
*/
-- test: precalculate BETWEEEN without path
EXPLAIN SELECT * FROM test WHERE 4 * 3 BETWEEN 3 + 6 AND 5 * 10;
/* result:
{
plan: "table.Scan(\"test\")"
}
*/