aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-01-28 17:39:31 +0000
committerdrh <>2024-01-28 17:39:31 +0000
commit5b480ead99fdc720f28fc0d6e32f1f0d3be22626 (patch)
treeb393c3b892960b143c6355c3f3943f0f97f7d12d /src
parentd921533954deeea925b73e3f5fe9d6e2aff194ef (diff)
downloadsqlite-5b480ead99fdc720f28fc0d6e32f1f0d3be22626.tar.gz
sqlite-5b480ead99fdc720f28fc0d6e32f1f0d3be22626.zip
Automatically disable the DISTINCT optimization during query planning if the
ORDER BY clause exceeds 63 terms. dbsqlfuzz afd1d61fc27d14938a0d78a50970fa1e9fbfee58. FossilOrigin-Name: d4c193f0b49f4950b20c2f0e6aa037d2ed7d8c0b4687c14923b3a0d0d4a1b3fd
Diffstat (limited to 'src')
-rw-r--r--src/where.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/where.c b/src/where.c
index 4ff2815ba..77813666e 100644
--- a/src/where.c
+++ b/src/where.c
@@ -6056,7 +6056,10 @@ WhereInfo *sqlite3WhereBegin(
/* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */
testcase( pOrderBy && pOrderBy->nExpr==BMS-1 );
- if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0;
+ if( pOrderBy && pOrderBy->nExpr>=BMS ){
+ pOrderBy = 0;
+ wctrlFlags &= ~WHERE_WANT_DISTINCT;
+ }
/* The number of tables in the FROM clause is limited by the number of
** bits in a Bitmask