diff options
author | drh <drh@noemail.net> | 2017-07-19 19:48:40 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2017-07-19 19:48:40 +0000 |
commit | 3e34eabcdff57778702f781c4d4ea7b3529711dc (patch) | |
tree | 3be3fee1c06587836fda96701d949e646919c21e /src/expr.c | |
parent | 885f410472a33c7c9c18895df1b299c8fe2707ba (diff) | |
download | sqlite-3e34eabcdff57778702f781c4d4ea7b3529711dc.tar.gz sqlite-3e34eabcdff57778702f781c4d4ea7b3529711dc.zip |
Allow indexes to be created on date/time functions as long as the 'now'
date and the 'localtime' and 'utc' modifiers are not used.
FossilOrigin-Name: 0a5e1c04d9d07bb7fd6546a9ddac1bf42b19ea19c2b79570aea6cd4226887a27
Diffstat (limited to 'src/expr.c')
-rw-r--r-- | src/expr.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/expr.c b/src/expr.c index fce3aa38b..d6896edaf 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3238,8 +3238,9 @@ void sqlite3ExprCodeLoadIndexColumn( if( iTabCol==XN_EXPR ){ assert( pIdx->aColExpr ); assert( pIdx->aColExpr->nExpr>iIdxCol ); - pParse->iSelfTab = iTabCur; + pParse->iSelfTab = iTabCur + 1; sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut); + pParse->iSelfTab = 0; }else{ sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, iTabCol, regOut); @@ -3489,7 +3490,7 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ }else{ /* Coding an expression that is part of an index where column names ** in the index refer to the table to which the index belongs */ - iTab = pParse->iSelfTab; + iTab = pParse->iSelfTab - 1; } } return sqlite3ExprCodeGetColumn(pParse, pExpr->pTab, @@ -3826,8 +3827,8 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ if( !pColl ) pColl = db->pDfltColl; sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); } - sqlite3VdbeAddOp4(v, OP_Function0, constMask, r1, target, - (char*)pDef, P4_FUNCDEF); + sqlite3VdbeAddOp4(v, pParse->iSelfTab ? OP_PureFunc0 : OP_Function0, + constMask, r1, target, (char*)pDef, P4_FUNCDEF); sqlite3VdbeChangeP5(v, (u8)nFarg); if( nFarg && constMask==0 ){ sqlite3ReleaseTempRange(pParse, r1, nFarg); |