1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

min() ignores NULL values. Ticket #800. (CVS 1802)

FossilOrigin-Name: 166234a2b61e1d6a501e48dde1caec0a02bec90b
This commit is contained in:
drh
2004-07-18 20:52:32 +00:00
parent e29b1a05a7
commit 9eb516c0eb
9 changed files with 97 additions and 34 deletions

View File

@@ -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.195 2004/06/21 10:45:09 danielk1977 Exp $
** $Id: select.c,v 1.196 2004/07/18 20:52:32 drh Exp $
*/
#include "sqliteInt.h"
@@ -2076,6 +2076,14 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
sqlite3VdbeOp3(v, OP_OpenRead, base+1, pIdx->tnum,
(char*)&pIdx->keyInfo, P3_KEYINFO);
sqlite3VdbeAddOp(v, seekOp, base+1, 0);
if( seekOp==OP_Rewind ){
int addr;
sqlite3VdbeAddOp(v, OP_SetNumColumns, base+1, pIdx->nColumn+1);
sqlite3VdbeAddOp(v, OP_KeyAsData, base+1, 1);
addr = sqlite3VdbeAddOp(v, OP_IdxColumn, base+1, 0);
sqlite3VdbeAddOp(v, OP_NotNull, 1, addr+3);
sqlite3VdbeAddOp(v, OP_Next, 1, addr);
}
sqlite3VdbeAddOp(v, OP_IdxRecno, base+1, 0);
sqlite3VdbeAddOp(v, OP_Close, base+1, 0);
sqlite3VdbeAddOp(v, OP_MoveGe, base, 0);