mirror of
https://github.com/sqlite/sqlite.git
synced 2025-12-03 08:01:19 +03:00
When generating WHERE clause terms internally for NATURAL and USING joins, identify the table by its position in the FROM list, not by its name or alias. Fix for [b73fb0bd64].
FossilOrigin-Name: 6fe6371175482d38ac4aeea994c7b20c18b7de01
This commit is contained in:
@@ -394,6 +394,27 @@ lookupname_end:
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Allocate and return a pointer to an expression to load the column iCol
|
||||
** from datasource iSrc datasource in SrcList pSrc.
|
||||
*/
|
||||
Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
|
||||
Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
|
||||
if( p ){
|
||||
struct SrcList_item *pItem = &pSrc->a[iSrc];
|
||||
p->pTab = pItem->pTab;
|
||||
p->iTable = pItem->iCursor;
|
||||
if( p->pTab->iPKey==iCol ){
|
||||
p->iColumn = -1;
|
||||
}else{
|
||||
p->iColumn = iCol;
|
||||
pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
|
||||
}
|
||||
ExprSetProperty(p, EP_Resolved);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
** This routine is callback for sqlite3WalkExpr().
|
||||
**
|
||||
|
||||
Reference in New Issue
Block a user