aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sqliteInt.h1
-rw-r--r--src/where.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index c1e055b26..9f47ffdde 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -956,6 +956,7 @@ struct sqlite3 {
#define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */
#define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */
#define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */
+#define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */
#define SQLITE_OptMask 0xff /* Mask of all disablable opts */
/*
diff --git a/src/where.c b/src/where.c
index 85a52fadf..05d955bad 100644
--- a/src/where.c
+++ b/src/where.c
@@ -4598,6 +4598,10 @@ WhereInfo *sqlite3WhereBegin(
pWInfo->savedNQueryLoop = pParse->nQueryLoop;
pMaskSet = (WhereMaskSet*)&pWC[1];
+ /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via
+ ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */
+ if( db->flags & SQLITE_DistinctOpt ) pDistinct = 0;
+
/* Split the WHERE clause into separate subexpressions where each
** subexpression is separated by an AND operator.
*/