aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2025-03-14 11:14:52 +0000
committerstephan <stephan@noemail.net>2025-03-14 11:14:52 +0000
commit5390f95f071ae83d2d89742b7a94ec1bfec6f6ff (patch)
tree3eba9019d68ded8463afa908365f262326ede5d9 /src/select.c
parent69eaadbee3dc5912aba995288bfb20eeeb1222e6 (diff)
parent1560045c328e5dc3b9a09e9c975b8626f984ef4f (diff)
downloadsqlite-5390f95f071ae83d2d89742b7a94ec1bfec6f6ff.tar.gz
sqlite-5390f95f071ae83d2d89742b7a94ec1bfec6f6ff.zip
Minor doc corrections for the sahpool-digest fix and merge in current trunk.
FossilOrigin-Name: 500f2e6ec74b4c0e4ac0365ba4e0d81ed6df8dd09dc0f8af65d294c3453f8865
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c
index e7db19533..904290223 100644
--- a/src/select.c
+++ b/src/select.c
@@ -7201,6 +7201,7 @@ static void agginfoFree(sqlite3 *db, void *pArg){
** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
** * The outer query is a simple count(*) with no WHERE clause or other
** extraneous syntax.
+** * None of the subqueries are DISTINCT (forumpost/a860f5fb2e 2025-03-10)
**
** Return TRUE if the optimization is undertaken.
*/
@@ -7233,7 +7234,11 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
if( pSub->pWhere ) return 0; /* No WHERE clause */
if( pSub->pLimit ) return 0; /* No LIMIT clause */
- if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
+ if( pSub->selFlags & (SF_Aggregate|SF_Distinct) ){
+ testcase( pSub->selFlags & SF_Aggregate );
+ testcase( pSub->selFlags & SF_Distinct );
+ return 0; /* Not an aggregate nor DISTINCT */
+ }
assert( pSub->pHaving==0 ); /* Due to the previous */
pSub = pSub->pPrior; /* Repeat over compound */
}while( pSub );