mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
After code is generated for a subquery, delete the Select structure in order
to force the temporary table to be used and to prevent the subquery from being evaluated a second time. Ticket #601. (CVS 1216) FossilOrigin-Name: 1cff18868dab5f8ead8ed8d07e088d7fdda04569
This commit is contained in:
14
src/select.c
14
src/select.c
@@ -12,7 +12,7 @@
|
||||
** This file contains C code routines that are called by the parser
|
||||
** to handle SELECT statements in SQLite.
|
||||
**
|
||||
** $Id: select.c,v 1.150 2004/01/30 02:01:04 drh Exp $
|
||||
** $Id: select.c,v 1.151 2004/02/09 14:37:50 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -2404,6 +2404,18 @@ int sqliteSelect(
|
||||
sqliteVdbeAddOp(v, OP_NullCallback, pEList->nExpr, 0);
|
||||
}
|
||||
|
||||
/* If this was a subquery, we have now converted the subquery into a
|
||||
** temporary table. So delete the subquery structure from the parent
|
||||
** to prevent this subquery from being evaluated again and to force the
|
||||
** the use of the temporary table.
|
||||
*/
|
||||
if( pParent ){
|
||||
assert( pParent->pSrc->nSrc>parentTab );
|
||||
assert( pParent->pSrc->a[parentTab].pSelect==p );
|
||||
sqliteSelectDelete(p);
|
||||
pParent->pSrc->a[parentTab].pSelect = 0;
|
||||
}
|
||||
|
||||
/* The SELECT was successfully coded. Set the return code to 0
|
||||
** to indicate no errors.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user