diff options
author | stephan <stephan@noemail.net> | 2025-03-10 17:35:00 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2025-03-10 17:35:00 +0000 |
commit | e0fa42053fe1603de66d23a5a17d0147450d162d (patch) | |
tree | 35ee2c31902dfa65f35dc25c10715eef88170402 /src | |
parent | b37f8b97143b6796ef794edcf004014288c21923 (diff) | |
parent | 09eba154b235f35a710da1d0096d9e1b3d5bda04 (diff) | |
download | sqlite-e0fa42053fe1603de66d23a5a17d0147450d162d.tar.gz sqlite-e0fa42053fe1603de66d23a5a17d0147450d162d.zip |
Merge trunk into the cygwin-fixes branch.
FossilOrigin-Name: f3d14433f24f89558e72a9085c950bc72440e9933d6b4ff59d6e603d25e39422
Diffstat (limited to 'src')
-rw-r--r-- | src/select.c | 7 |
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 ); |