/ Check-in [17b3d2218c]
Login

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

Overview
Comment:Ensure that when the col in an operator like "val IN(col)" is a column of a view, its affinity is not used to coerce val. Fix for [0a5e2c1d].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 17b3d2218c02a4005d4c96471c452105b54abb25901ae62990b01f0c955135fe
User & Date: dan 2019-08-06 21:16:28
Context
2019-08-07
13:25
Do not make SQLITE_READ authorizer calls for tables without names, as all such tables will be internal-use-only tables for subqueries and whatnot. check-in: 193c87fc96 user: drh tags: trunk
2019-08-06
21:16
Ensure that when the col in an operator like "val IN(col)" is a column of a view, its affinity is not used to coerce val. Fix for [0a5e2c1d]. check-in: 17b3d2218c user: dan tags: trunk
20:55
Improved reuse of file descriptors for which close() is delayed to prevent clearing of posix advisory locks. check-in: 509c1ba26a user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

  3471   3471           pNew = sqlite3ExprDup(db, pCopy, 0);
  3472   3472           if( pNew && pSubst->isLeftJoin ){
  3473   3473             ExprSetProperty(pNew, EP_CanBeNull);
  3474   3474           }
  3475   3475           if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
  3476   3476             pNew->iRightJoinTable = pExpr->iRightJoinTable;
  3477   3477             ExprSetProperty(pNew, EP_FromJoin);
         3478  +        }
         3479  +        if( pNew && ExprHasProperty(pExpr,EP_Generic) ){
         3480  +          ExprSetProperty(pNew, EP_Generic);
  3478   3481           }
  3479   3482           sqlite3ExprDelete(db, pExpr);
  3480   3483           pExpr = pNew;
  3481   3484         }
  3482   3485       }
  3483   3486     }else{
  3484   3487       if( pExpr->op==TK_IF_NULL_ROW && pExpr->iTable==pSubst->iTable ){

Changes to test/view.test.

   756    756   } 0
   757    757   do_execsql_test view-27.8 {
   758    758     SELECT 1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) WHERE c1<c0
   759    759   } {}
   760    760   do_execsql_test view-27.9 {
   761    761     SELECT 1 FROM (SELECT t0.c0 AS c0, AVG(t0.c1) AS c1 FROM t0) WHERE c0<c1
   762    762   } {1}
          763  +
          764  +#-------------------------------------------------------------------------
          765  +reset_db
          766  +do_execsql_test view-28.0 {
          767  +  CREATE TABLE t0(c0 TEXT);
          768  +  CREATE VIEW v0(c0) AS SELECT t0.c0 FROM t0;
          769  +  INSERT INTO t0(c0) VALUES ('0');
          770  +}
          771  +do_execsql_test view-28.1 {
          772  +  SELECT 0 IN (c0) FROM t0;
          773  +} {0}
          774  +do_execsql_test view-28.2 {
          775  +  SELECT 0 IN (c0) FROM (SELECT c0 FROM t0);
          776  +} {0}
   763    777   
   764    778   finish_test