/ Check-in [b67bb16c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In the expression-tree comparison routine, do not compiler Expr.iColumn and Expr.iTable for TK_STRING expressions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b67bb16c72c3e015ea82665ada9b5d3289ef6fb2
User & Date: drh 2015-04-17 19:41:37
Context
2015-04-17
20:51
Fix a problem affecting some fts3 UPDATE and DELETE statements on order=DESC tables. check-in: 284c1623 user: dan tags: trunk
19:41
In the expression-tree comparison routine, do not compiler Expr.iColumn and Expr.iTable for TK_STRING expressions. check-in: b67bb16c user: drh tags: trunk
18:52
Always resolve symbols in all ORDER BY clauses of a compound-SELECT, even illegal ORDER BY clauses. check-in: 6c39ef73 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
  }
  if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
  if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
    if( combinedFlags & EP_xIsSelect ) return 2;
    if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2;
    if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2;
    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
    if( ALWAYS((combinedFlags & EP_Reduced)==0) ){
      if( pA->iColumn!=pB->iColumn ) return 2;
      if( pA->iTable!=pB->iTable 
       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
    }
  }
  return 0;
}







|







4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
  }
  if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
  if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
    if( combinedFlags & EP_xIsSelect ) return 2;
    if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2;
    if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2;
    if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
    if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){
      if( pA->iColumn!=pB->iColumn ) return 2;
      if( pA->iTable!=pB->iTable 
       && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2;
    }
  }
  return 0;
}

Changes to src/resolve.c.

456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
  **
  ** Because no reference was made to outer contexts, the pNC->nRef
  ** fields are not changed in any context.
  */
  if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){
    pExpr->op = TK_STRING;
    pExpr->pTab = 0;
    pExpr->iTable = -1;
    return WRC_Prune;
  }

  /*
  ** cnt==0 means there was not match.  cnt>1 means there were two or
  ** more matches.  Either way, we have an error.
  */







<







456
457
458
459
460
461
462

463
464
465
466
467
468
469
  **
  ** Because no reference was made to outer contexts, the pNC->nRef
  ** fields are not changed in any context.
  */
  if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){
    pExpr->op = TK_STRING;
    pExpr->pTab = 0;

    return WRC_Prune;
  }

  /*
  ** cnt==0 means there was not match.  cnt>1 means there were two or
  ** more matches.  Either way, we have an error.
  */

Changes to test/expr.test.

938
939
940
941
942
943
944








945
946
947
  }
} {9.22337203685478e+18}
do_realnum_test expr-13.7 {
  execsql {
    SELECT '9223372036854775807.0'+0
  }
} {9.22337203685478e+18}










finish_test







>
>
>
>
>
>
>
>



938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
  }
} {9.22337203685478e+18}
do_realnum_test expr-13.7 {
  execsql {
    SELECT '9223372036854775807.0'+0
  }
} {9.22337203685478e+18}

do_execsql_test expr-13.8 {
  SELECT "" <= '';
} {1}
do_execsql_test expr-13.9 {
  SELECT '' <= "";
} {1}



finish_test