1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-14 00:22:38 +03:00

Recognize TK_COLLATE operators that have been transformed into TK_REGISTER.

Skip both TK_COLLATE and TK_AS operators when looking for the top of an
expression.

FossilOrigin-Name: f66c1db2965054f38125218202b6a6ec62d57666
This commit is contained in:
drh
2012-12-08 00:52:14 +00:00
parent 85d641f948
commit d91eba9673
3 changed files with 13 additions and 10 deletions

View File

@@ -85,10 +85,13 @@ Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){
}
/*
** Skip over any TK_COLLATE operator in an expression.
** Skip over any TK_COLLATE and/or TK_AS operators at the root of
** an expression.
*/
Expr *sqlite3ExprSkipCollate(Expr *pExpr){
if( pExpr && pExpr->op==TK_COLLATE ) pExpr = pExpr->pLeft;
while( pExpr && (pExpr->op==TK_COLLATE || pExpr->op==TK_AS) ){
pExpr = pExpr->pLeft;
}
return pExpr;
}
@@ -111,7 +114,7 @@ CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
p = p->pLeft;
continue;
}
if( op==TK_COLLATE ){
if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){
if( db->init.busy ){
/* Do not report errors when parsing while the schema */
pColl = sqlite3FindCollSeq(db, ENC(db), p->u.zToken, 0);