mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Disable the LIKE optimization if the affinity of the LHS column is
not TEXT. Ticket #3901. (CVS 6727) FossilOrigin-Name: a255c645c46ae03b65f862858fe57e462076e1fc
This commit is contained in:
10
src/where.c
10
src/where.c
@@ -16,7 +16,7 @@
|
||||
** so is applicable. Because this module is responsible for selecting
|
||||
** indices, you might also think of this module as the "query optimizer".
|
||||
**
|
||||
** $Id: where.c,v 1.401 2009/06/06 15:17:28 drh Exp $
|
||||
** $Id: where.c,v 1.402 2009/06/07 23:45:11 drh Exp $
|
||||
*/
|
||||
#include "sqliteInt.h"
|
||||
|
||||
@@ -654,17 +654,15 @@ static int isLikeOrGlob(
|
||||
}
|
||||
pColl = sqlite3ExprCollSeq(pParse, pLeft);
|
||||
assert( pColl!=0 || pLeft->iColumn==-1 );
|
||||
if( pColl==0 ){
|
||||
/* No collation is defined for the ROWID. Use the default. */
|
||||
pColl = db->pDfltColl;
|
||||
}
|
||||
if( pColl==0 ) return 0;
|
||||
if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) &&
|
||||
(pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){
|
||||
return 0;
|
||||
}
|
||||
if( sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ) return 0;
|
||||
z = pRight->u.zToken;
|
||||
cnt = 0;
|
||||
if( z ){
|
||||
if( ALWAYS(z) ){
|
||||
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
|
||||
cnt++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user