diff options
author | drh <drh@noemail.net> | 2020-08-19 23:32:06 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2020-08-19 23:32:06 +0000 |
commit | 46fe138d98664b30ada114b1f76b52e95d00575c (patch) | |
tree | 6e171ad2837c7407d96fc3d20d1d5dac0c1eb9a0 /src | |
parent | 1d42e619acb77717cbf318e6fb473b6a756e9160 (diff) | |
download | sqlite-46fe138d98664b30ada114b1f76b52e95d00575c.tar.gz sqlite-46fe138d98664b30ada114b1f76b52e95d00575c.zip |
Do not skip over TK_IF_NULL_ROW operators when bypassing TK_COLLATE operators.
Fix to check-in [ac31edd3eeafcef4] which was itself a fix for ticket
[45f4bf4eb4ffd788].
FossilOrigin-Name: 871f2ddcfbb9196dbd851a350e3471ee6d242d86bbd755201f7e2406fce3ac55
Diffstat (limited to 'src')
-rw-r--r-- | src/expr.c | 6 | ||||
-rw-r--r-- | src/select.c | 2 | ||||
-rw-r--r-- | src/sqliteInt.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/expr.c b/src/expr.c index b64ea28bf..244412b38 100644 --- a/src/expr.c +++ b/src/expr.c @@ -44,7 +44,7 @@ char sqlite3TableColumnAffinity(Table *pTab, int iCol){ */ char sqlite3ExprAffinity(const Expr *pExpr){ int op; - while( ExprHasProperty(pExpr, EP_Skip) ){ + while( ExprHasProperty(pExpr, EP_Skip|EP_IfNullRow) ){ assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW ); pExpr = pExpr->pLeft; assert( pExpr!=0 ); @@ -115,7 +115,7 @@ Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ */ Expr *sqlite3ExprSkipCollate(Expr *pExpr){ while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ - assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW ); + assert( pExpr->op==TK_COLLATE ); pExpr = pExpr->pLeft; } return pExpr; @@ -134,7 +134,7 @@ Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ assert( pExpr->op==TK_FUNCTION ); pExpr = pExpr->x.pList->a[0].pExpr; }else{ - assert( pExpr->op==TK_COLLATE || pExpr->op==TK_IF_NULL_ROW ); + assert( pExpr->op==TK_COLLATE ); pExpr = pExpr->pLeft; } } diff --git a/src/select.c b/src/select.c index 8b1fae75a..9568dbadc 100644 --- a/src/select.c +++ b/src/select.c @@ -3506,7 +3506,7 @@ static Expr *substExpr( ifNullRow.op = TK_IF_NULL_ROW; ifNullRow.pLeft = pCopy; ifNullRow.iTable = pSubst->iNewTable; - ifNullRow.flags = EP_Skip; + ifNullRow.flags = EP_IfNullRow; pCopy = &ifNullRow; } testcase( ExprHasProperty(pCopy, EP_Subquery) ); diff --git a/src/sqliteInt.h b/src/sqliteInt.h index a5d108b6c..f2c4f63c0 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2715,7 +2715,7 @@ struct Expr { #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ #define EP_Win 0x008000 /* Contains window functions */ #define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ - /* 0x020000 // available for reuse */ +#define EP_IfNullRow 0x020000 /* The TK_IF_NULL_ROW opcode */ #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ #define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */ |