mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-14 00:22:38 +03:00
Ignore NULLs in a subquery as the right operand of IN. Ticket #565. (CVS 1175)
FossilOrigin-Name: c9e7996fb9080b715e9b273a3ac3ed3744e10a77
This commit is contained in:
15
src/select.c
15
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.146 2003/09/27 13:39:39 drh Exp $
|
||||
** $Id: select.c,v 1.147 2004/01/14 13:38:54 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -479,16 +479,19 @@ static int selectInnerLoop(
|
||||
** item into the set table with bogus data.
|
||||
*/
|
||||
case SRT_Set: {
|
||||
int lbl = sqliteVdbeMakeLabel(v);
|
||||
int addr1 = sqliteVdbeCurrentAddr(v);
|
||||
int addr2;
|
||||
assert( nColumn==1 );
|
||||
sqliteVdbeAddOp(v, OP_IsNull, -1, lbl);
|
||||
sqliteVdbeAddOp(v, OP_NotNull, -1, addr1+3);
|
||||
sqliteVdbeAddOp(v, OP_Pop, 1, 0);
|
||||
addr2 = sqliteVdbeAddOp(v, OP_Goto, 0, 0);
|
||||
if( pOrderBy ){
|
||||
pushOntoSorter(pParse, v, pOrderBy);
|
||||
}else{
|
||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
|
||||
}
|
||||
sqliteVdbeResolveLabel(v, lbl);
|
||||
sqliteVdbeChangeP2(v, addr2, sqliteVdbeCurrentAddr(v));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -588,7 +591,9 @@ static void generateSortTail(
|
||||
}
|
||||
case SRT_Set: {
|
||||
assert( nColumn==1 );
|
||||
sqliteVdbeAddOp(v, OP_IsNull, -1, sqliteVdbeCurrentAddr(v)+3);
|
||||
sqliteVdbeAddOp(v, OP_NotNull, -1, sqliteVdbeCurrentAddr(v)+3);
|
||||
sqliteVdbeAddOp(v, OP_Pop, 1, 0);
|
||||
sqliteVdbeAddOp(v, OP_Goto, 0, sqliteVdbeCurrentAddr(v)+3);
|
||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||
sqliteVdbeAddOp(v, OP_PutStrKey, iParm, 0);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user