Make sure the KeyInfo.aSortOrder array is always allocated so that we never
have to test for KeyInfo.aSortOrder==0 in performance-critical loops.
FossilOrigin-Name: 45793f0b844fee7445bc9269b403f89a58f77150
diff --git a/src/expr.c b/src/expr.c
index 89172f9..3fb51cf 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1662,6 +1662,7 @@
case TK_IN: {
char affinity; /* Affinity of the LHS of the IN */
KeyInfo keyInfo; /* Keyinfo for the generated table */
+ static u8 sortOrder = 0; /* Fake aSortOrder for keyInfo */
int addr; /* Address of OP_OpenEphemeral instruction */
Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */
@@ -1689,6 +1690,7 @@
if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED);
memset(&keyInfo, 0, sizeof(keyInfo));
keyInfo.nField = 1;
+ keyInfo.aSortOrder = &sortOrder;
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
/* Case 1: expr IN (SELECT ...)
@@ -1729,6 +1731,7 @@
affinity = SQLITE_AFF_NONE;
}
keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft);
+ keyInfo.aSortOrder = &sortOrder;
/* Loop through each expression in <exprlist>. */
r1 = sqlite3GetTempReg(pParse);