/ Check-in [8168021f9a]
Login

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

Overview
Comment:Fix a problem in ALTER TABLE triggered by views or triggers that include the construction "ORDER BY true" or "ORDER BY false".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8168021f9ab5fb8b4888257963c9ec68fd1dfeedaf6bba4b8e07438001d0be0f
User & Date: dan 2019-08-01 10:58:46
Context
2019-08-01
15:18
Add new release tests for windows to releasetest_data.tcl. check-in: 1b330ec24c user: dan tags: trunk
10:58
Fix a problem in ALTER TABLE triggered by views or triggers that include the construction "ORDER BY true" or "ORDER BY false". check-in: 8168021f9a user: dan tags: trunk
2019-07-31
21:08
Update "releasetest_data.tcl" so that it is a standalone script that generates sh or batch scripts to run each tcl test run at release time. Update wapptest.tcl to use it. check-in: 559c2dd672 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/resolve.c.

  1274   1274     const char *zType     /* "ORDER" or "GROUP" */
  1275   1275   ){
  1276   1276     int i;
  1277   1277     sqlite3 *db = pParse->db;
  1278   1278     ExprList *pEList;
  1279   1279     struct ExprList_item *pItem;
  1280   1280   
  1281         -  if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
         1281  +  if( pOrderBy==0 || pParse->db->mallocFailed || IN_RENAME_OBJECT ) return 0;
  1282   1282     if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
  1283   1283       sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType);
  1284   1284       return 1;
  1285   1285     }
  1286   1286     pEList = pSelect->pEList;
  1287   1287     assert( pEList!=0 );  /* sqlite3SelectNew() guarantees this */
  1288   1288     for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){

Changes to test/altertab3.test.

   340    340       SELECT sum() FILTER (WHERE (SELECT sum() FILTER (WHERE 0)) AND a);
   341    341     END;
   342    342   }
   343    343   
   344    344   do_catchsql_test 14.2 {
   345    345     ALTER TABLE t1 RENAME TO t1x;
   346    346   } {1 {error in trigger AFTER: no such column: a}}
          347  +
          348  +#-------------------------------------------------------------------------
          349  +reset_db
          350  +
          351  +do_execsql_test 16.1 {
          352  +  CREATE TABLE t1(x);
          353  +  CREATE TRIGGER AFTER INSERT ON t1 BEGIN
          354  +    SELECT (WITH t2 AS (WITH t3 AS (SELECT true)
          355  +          SELECT * FROM t3 ORDER BY true COLLATE nocase)
          356  +        SELECT 11);
          357  +
          358  +    WITH t4 AS (SELECT * FROM t1) SELECT 33;
          359  +  END;
          360  +}
          361  +
          362  +do_execsql_test 16.2 {
          363  +  ALTER TABLE t1 RENAME TO t1x;
          364  +}
   347    365   
   348    366   finish_test
   349    367