1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Make sure that a DISTINCT query with an ORDER BY works correctly even if

it uses a descending index.  Fix for ticket [c5ea805691bfc4204b1cb9e].

FossilOrigin-Name: 0d3aef97ebddf422b8bdcbc5878970c6129e3f54
This commit is contained in:
drh
2014-12-04 21:54:58 +00:00
parent 1d32488037
commit dea7d70d1b
4 changed files with 39 additions and 10 deletions

View File

@@ -4829,7 +4829,7 @@ int sqlite3Select(
**
** is transformed to:
**
** SELECT xyz FROM ... GROUP BY xyz
** SELECT xyz FROM ... GROUP BY xyz ORDER BY xyz
**
** The second form is preferred as a single index (or temp-table) may be
** used for both the ORDER BY and DISTINCT processing. As originally
@@ -4842,7 +4842,6 @@ int sqlite3Select(
p->selFlags &= ~SF_Distinct;
p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0);
pGroupBy = p->pGroupBy;
sSort.pOrderBy = 0;
/* Notice that even thought SF_Distinct has been cleared from p->selFlags,
** the sDistinct.isTnct is still set. Hence, isTnct represents the
** original setting of the SF_Distinct flag, not the current setting */