1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Do not try to access a generated column through an index if the collating

sequence for the generated column is non-standard.
Part 2 of ticket [e0a8120553f4b082]

FossilOrigin-Name: 056bb8dcbdc45989c5c6e86d2966200062e3c01c382ec52aae37c828104b4496
This commit is contained in:
drh
2019-12-20 22:46:41 +00:00
parent 67b9ba1732
commit ed0c34857a
4 changed files with 30 additions and 9 deletions

View File

@@ -1190,7 +1190,17 @@ static void whereIndexExprTrans(
x.pIdxExpr = aColExpr->a[iIdxCol].pExpr;
w.xExprCallback = whereIndexExprTransNode;
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
}else if( iRef>=0 && (pTab->aCol[iRef].colFlags & COLFLAG_VIRTUAL)!=0 ){
}else if( iRef>=0
&& (pTab->aCol[iRef].colFlags & COLFLAG_VIRTUAL)!=0
&& (pTab->aCol[iRef].zColl==0
|| sqlite3StrICmp(pTab->aCol[iRef].zColl, sqlite3StrBINARY)==0)
){
/* Check to see if there are direct references to generated columns
** that are contained in the index. Pulling the generated column
** out of the index is an optimization only - the main table is always
** available if the index cannot be used. To avoid unnecessary
** complication, omit this optimization if the collating sequence for
** the column is non-standard */
x.iTabCol = iRef;
w.xExprCallback = whereIndexExprTransColumn;
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */