/ Check-in [2d9cd067]
Login

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

Overview
Comment:Fix a problem with running ALTER TABLE on a schema that contains expressions of the type "col IN ()" (empty set on RHS of IN operator).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2d9cd06715092c312c8c0ec392696a0e90ed090b074e2082e0b830f1399aa941
User & Date: dan 2019-01-24 16:27:10
Context
2019-01-24
17:41
Fix a buffer overread in fts3 that could occur in a prefix query on a corrupted database. check-in: d0d56893 user: dan tags: trunk
16:27
Fix a problem with running ALTER TABLE on a schema that contains expressions of the type "col IN ()" (empty set on RHS of IN operator). check-in: 2d9cd067 user: dan tags: trunk
16:07
Omit deprecated PRAGMAs when compiling with the -DSQLITE_OMIT_DEPRECATED option. check-in: 008112bc user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/parse.y.

  1162   1162         **
  1163   1163         **      expr1 IN ()
  1164   1164         **      expr1 NOT IN ()
  1165   1165         **
  1166   1166         ** simplify to constants 0 (false) and 1 (true), respectively,
  1167   1167         ** regardless of the value of expr1.
  1168   1168         */
  1169         -      sqlite3ExprDelete(pParse->db, A);
  1170         -      A = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[N],1);
         1169  +      if( IN_RENAME_OBJECT==0 ){
         1170  +        sqlite3ExprDelete(pParse->db, A);
         1171  +        A = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[N],1);
         1172  +      }
  1171   1173       }else if( Y->nExpr==1 ){
  1172   1174         /* Expressions of the form:
  1173   1175         **
  1174   1176         **      expr1 IN (?1)
  1175   1177         **      expr1 NOT IN (?2)
  1176   1178         **
  1177   1179         ** with exactly one value on the RHS can be simplified to something

Changes to test/altertab3.test.

    59     59     SELECT sql FROM sqlite_master WHERE name = 'r1';
    60     60   } {{CREATE TRIGGER r1 AFTER INSERT ON "t1x" WHEN new.a NOT NULL BEGIN
    61     61       SELECT a,b, a name FROM "t1x" 
    62     62         INTERSECT 
    63     63       SELECT a,b,c FROM "t1x" WHERE b>='d' ORDER BY name;
    64     64       SELECT new.c;
    65     65     END}}
           66  +
           67  +#-------------------------------------------------------------------------
           68  +reset_db
           69  +do_execsql_test 3.0 {
           70  +  CREATE TABLE t1(a, b, c, d);
           71  +  CREATE VIEW v1 AS SELECT * FROM t1 WHERE a=1 OR (b IN ());
           72  +}
           73  +
           74  +do_execsql_test 3.1 {
           75  +  ALTER TABLE t1 RENAME b TO bbb;
           76  +}
           77  +
           78  +do_execsql_test 3.2 {
           79  +  SELECT sql FROM sqlite_master WHERE name = 'v1'
           80  +} {{CREATE VIEW v1 AS SELECT * FROM t1 WHERE a=1 OR (bbb IN ())}}
           81  +
           82  +
           83  +
    66     84   finish_test
    67     85   
    68     86