1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

In a 3-fold compound SELECT make sure early code generation of the SELECTs

to the right do not dereference non-existant columns in SELECTs on the left. (CVS 6511)

FossilOrigin-Name: 414f340809c487901fa913026a342b19a2956c0a
This commit is contained in:
drh
2009-04-16 00:24:23 +00:00
parent 8dc09a0616
commit 10c081adf8
4 changed files with 25 additions and 12 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.507 2009/04/02 16:59:47 drh Exp $
** $Id: select.c,v 1.508 2009/04/16 00:24:24 drh Exp $
*/
#include "sqliteInt.h"
@@ -1394,7 +1394,8 @@ static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){
}else{
pRet = 0;
}
if( pRet==0 ){
assert( iCol>=0 );
if( pRet==0 && iCol<p->pEList->nExpr ){
pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr);
}
return pRet;
@@ -2101,7 +2102,7 @@ static int multiSelectOrderBy(
}
/* Compute the comparison permutation and keyinfo that is used with
** the permutation in order to comparisons to determine if the next
** the permutation used to determine if the next
** row of results comes from selectA or selectB. Also add explicit
** collations to the ORDER BY clause terms so that when the subqueries
** to the right and the left are evaluated, they use the correct