/ Check-in [e73ac0cb]
Login

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

Overview
Comment:Fix a broken assert() and comparison for INSERT INTO ... SELECT when the SELECT uses an unknown collating sequence.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e73ac0cbac257d2d2b28e51423e30d7449b6c7b5
User & Date: drh 2015-04-19 22:41:22
Context
2015-04-19
23:11
Fix an off-by-one assert() in the virtual table argument tokenizer. check-in: c83052e4 user: drh tags: trunk
22:41
Fix a broken assert() and comparison for INSERT INTO ... SELECT when the SELECT uses an unknown collating sequence. check-in: e73ac0cb user: drh tags: trunk
22:31
Silently ignore parser stack overflow when parsing a malformed schema in PRAGMA writable_schema mode. check-in: 2cb37b95 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

   645    645       addrTop = sqlite3VdbeCurrentAddr(v) + 1;
   646    646       sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop);
   647    647       sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield);
   648    648       dest.iSdst = bIdListInOrder ? regData : 0;
   649    649       dest.nSdst = pTab->nCol;
   650    650       rc = sqlite3Select(pParse, pSelect, &dest);
   651    651       regFromSelect = dest.iSdst;
   652         -    assert( pParse->nErr==0 || rc );
   653         -    if( rc || db->mallocFailed ) goto insert_cleanup;
          652  +    if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup;
   654    653       sqlite3VdbeAddOp1(v, OP_EndCoroutine, regYield);
   655    654       sqlite3VdbeJumpHere(v, addrTop - 1);                       /* label B: */
   656    655       assert( pSelect->pEList );
   657    656       nColumn = pSelect->pEList->nExpr;
   658    657   
   659    658       /* Set useTempTable to TRUE if the result of the SELECT statement
   660    659       ** should be written into a temporary table (template 4).  Set to

Changes to test/insert4.test.

   556    556       CREATE TABLE t2(x INTEGER PRIMARY KEY ON CONFLICT ROLLBACK, y);
   557    557       INSERT INTO t2 VALUES(1,3);
   558    558       INSERT INTO t1 SELECT * FROM t2;
   559    559       SELECT * FROM t1;
   560    560     }
   561    561   } {1 3}
   562    562   
          563  +do_catchsql_test insert4-9.1 {
          564  +  DROP TABLE IF EXISTS t1;
          565  +  CREATE TABLE t1(x);
          566  +  INSERT INTO t1(x) VALUES(5 COLLATE xyzzy) UNION SELECT 0;
          567  +} {1 {no such collation sequence: xyzzy}}
   563    568   
   564    569   finish_test