1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix the count-of-view optimization so that it is (correctly) disabled for

a query that includes a WHERE clause or a GROUP BY clause.

FossilOrigin-Name: 05897ca48a40c6771ff83ba8ecc3a5c60dafddf58651c222dd8cf89b9fc7b077
This commit is contained in:
drh
2019-05-15 18:42:15 +00:00
parent 58eaf76355
commit 73c53b39c9
4 changed files with 25 additions and 9 deletions

View File

@ -40,4 +40,17 @@ do_execsql_test 1.3 {
)
} {3}
# 2019-05-15
do_execsql_test 2.0 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES(1),(99),('abc');
CREATE VIEW v1(x,y) AS SELECT x,1 FROM t1 UNION ALL SELECT x,2 FROM t1;
SELECT count(*) FROM v1 WHERE x<>1;
} {4}
do_execsql_test 2.1 {
SELECT count(*) FROM v1 GROUP BY y;
} {3 3}
finish_test