mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Make sure min() and max() optimizations work for subqueries. Ticket #587. (CVS 1201)
FossilOrigin-Name: af73fbca839f8cbe39c21f1f9e439fe9b79005c8
This commit is contained in:
@@ -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.149 2004/01/24 20:18:13 drh Exp $
|
||||
** $Id: select.c,v 1.150 2004/01/30 02:01:04 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -1900,6 +1900,12 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
|
||||
generateColumnTypes(pParse, p->pSrc, p->pEList);
|
||||
}
|
||||
|
||||
/* If the output is destined for a temporary table, open that table.
|
||||
*/
|
||||
if( eDest==SRT_TempTable ){
|
||||
sqliteVdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
||||
}
|
||||
|
||||
/* Generating code to find the min or the max. Basically all we have
|
||||
** to do is find the first or the last entry in the chosen index. If
|
||||
** the min() or max() is on the INTEGER PRIMARY KEY, then find the first
|
||||
|
||||
Reference in New Issue
Block a user