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

Allow a HAVING clause on any aggregate query, even if there is no GROUP BY

clause.  This brings SQLite into closer agreement with PostgreSQL and fixes
the concern raised by 
[forum:/forumpost/1a7fea4651|forum post 1a7fea4651].

FossilOrigin-Name: 9322a7c21f1c22ba00e9b889223e89bc1591db6e561ce05091e905e98c1bf2b3
This commit is contained in:
drh
2022-06-21 13:41:24 +00:00
parent 4af6462fb8
commit b9294de1e6
6 changed files with 26 additions and 19 deletions

View File

@ -126,9 +126,12 @@ do_test count-2.7 {
do_test count-2.8 {
uses_op_count {SELECT count(*) FROM t2 WHERE a IS NOT NULL}
} {0}
do_test count-2.9 {
catchsql {SELECT count(*) FROM t2 HAVING count(*)>1}
} {1 {a GROUP BY clause is required before HAVING}}
do_execsql_test count-2.9a {
SELECT count(*) FROM t2 HAVING count(*)>1;
} {}
do_execsql_test count-2.9b {
SELECT count(*) FROM t2 HAVING count(*)<10;
} {0}
do_test count-2.10 {
uses_op_count {SELECT count(*) FROM (SELECT 1)}
} {0}