mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Add a pragma to disable the query flattener - for use during testing.
FossilOrigin-Name: 1d8550e5c88db0ea76aea579c1a5bf99d48fbe43
This commit is contained in:
11
src/select.c
11
src/select.c
@@ -957,7 +957,7 @@ static const char *columnType(
|
||||
** of the SELECT statement. Return the declaration type and origin
|
||||
** data for the result-set column of the sub-select.
|
||||
*/
|
||||
if( ALWAYS(iCol>=0 && iCol<pS->pEList->nExpr) ){
|
||||
if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){
|
||||
/* If iCol is less than zero, then the expression requests the
|
||||
** rowid of the sub-select or view. This expression is legal (see
|
||||
** test case misc2.2.2) - it always evaluates to NULL.
|
||||
@@ -2518,7 +2518,7 @@ static void substSelect(
|
||||
**
|
||||
** (11) The subquery and the outer query do not both have ORDER BY clauses.
|
||||
**
|
||||
** (12) Not implemented. Subsumed into restriction (3). Was previously
|
||||
** (**) Not implemented. Subsumed into restriction (3). Was previously
|
||||
** a separate restriction deriving from ticket #350.
|
||||
**
|
||||
** (13) The subquery and outer query do not both use LIMIT
|
||||
@@ -2592,6 +2592,13 @@ static int flattenSubquery(
|
||||
*/
|
||||
assert( p!=0 );
|
||||
assert( p->pPrior==0 ); /* Unable to flatten compound queries */
|
||||
|
||||
/* The "PRAGMA omit_flattener=ON" statement disables query flattening for
|
||||
** testing purposes. The only reason to disable the query flattener is
|
||||
** to verify that we get the same answer with and without the flattener.
|
||||
** In production use, there is never a reason to turn the flattener off. */
|
||||
if( db->flags & SQLITE_OmitFlattener ) return 0;
|
||||
|
||||
pSrc = p->pSrc;
|
||||
assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
|
||||
pSubitem = &pSrc->a[iFrom];
|
||||
|
||||
Reference in New Issue
Block a user