SQLite

Check-in [2b2a1ef74e]
Login

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

Overview
Comment:Make sure sufficient space is allocated for at least one VDBE cursor when autoincrement is used. Ticket [a696379c1f088].
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 2b2a1ef74e24857b8d18f6370894588fc2aa5ebb
User & Date: drh 2009-09-14 23:47:25.000
References
2009-09-21
12:57 Closed ticket [c472df6c1c]: Segmentation fault by instead of insert triggers plus 3 other changes (artifact: d02c4c220c user: drh)
2009-09-15
00:03 Fixed ticket [a696379c1f]: Access violation error trying to insert into triggered view plus 3 other changes (artifact: da685e3d7f user: drh)
Context
2009-09-17
00:41
When coding a trigger, assume that the "oldmask" requires all columns until we know otherwise. That pessimistic assumption assures that all necessary parameters are available on a cascading delete trigger. Ticket [e25d9ea771f] (check-in: 03e464be51 user: drh tags: trunk)
2009-09-14
23:47
Make sure sufficient space is allocated for at least one VDBE cursor when autoincrement is used. Ticket [a696379c1f088]. (check-in: 2b2a1ef74e user: drh tags: trunk)
2009-09-11
18:28
Set the execute permission bit on "configure". (check-in: f8c02b2b72 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/build.c.
192
193
194
195
196
197
198



199
200
201
202
203
204
205
  */
  if( v && ALWAYS(pParse->nErr==0) && !db->mallocFailed ){
#ifdef SQLITE_DEBUG
    FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
    sqlite3VdbeTrace(v, trace);
#endif
    assert( pParse->iCacheLevel==0 );  /* Disables and re-enables match */



    sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem,
                         pParse->nTab, pParse->nMaxArg, pParse->explain,
                         pParse->isMultiWrite && pParse->mayAbort);
    pParse->rc = SQLITE_DONE;
    pParse->colNamesSet = 0;
  }else if( pParse->rc==SQLITE_OK ){
    pParse->rc = SQLITE_ERROR;







>
>
>







192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
  */
  if( v && ALWAYS(pParse->nErr==0) && !db->mallocFailed ){
#ifdef SQLITE_DEBUG
    FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
    sqlite3VdbeTrace(v, trace);
#endif
    assert( pParse->iCacheLevel==0 );  /* Disables and re-enables match */
    /* A minimum of one cursor is required if autoincrement is used
    *  See ticket [a696379c1f08866] */
    if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1;
    sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem,
                         pParse->nTab, pParse->nMaxArg, pParse->explain,
                         pParse->isMultiWrite && pParse->mayAbort);
    pParse->rc = SQLITE_DONE;
    pParse->colNamesSet = 0;
  }else if( pParse->rc==SQLITE_OK ){
    pParse->rc = SQLITE_ERROR;
Changes to test/autoinc.test.
633
634
635
636
637
638
639

























640
641
  }
} {1 before-del-100 2 after-del-100 3 before-del-200 4 after-del-200 5 before-del-300 6 after-del-300}
do_test autoinc-3928.7 {
  db eval {
    SELECT * FROM sqlite_sequence WHERE name LIKE 't3928%' ORDER BY name;
  }
} {t3928 21 t3928c 6}


























finish_test







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
  }
} {1 before-del-100 2 after-del-100 3 before-del-200 4 after-del-200 5 before-del-300 6 after-del-300}
do_test autoinc-3928.7 {
  db eval {
    SELECT * FROM sqlite_sequence WHERE name LIKE 't3928%' ORDER BY name;
  }
} {t3928 21 t3928c 6}

# Ticket [a696379c1f0886615541a48b35bd8181a80e88f8]
do_test autoinc-a69637.1 {
  db eval {
    CREATE TABLE ta69637_1(x INTEGER PRIMARY KEY AUTOINCREMENT, y);
    CREATE TABLE ta69637_2(z);
    CREATE TRIGGER ra69637_1 AFTER INSERT ON ta69637_2 BEGIN
      INSERT INTO ta69637_1(y) VALUES(new.z+1);
    END;
    INSERT INTO ta69637_2 VALUES(123);
    SELECT * FROM ta69637_1;
  }
} {1 124}
do_test autoinc-a69637.2 {
  db eval {
    CREATE VIEW va69637_2 AS SELECT * FROM ta69637_2;
    CREATE TRIGGER ra69637_2 INSTEAD OF INSERT ON va69637_2 BEGIN
      INSERT INTO ta69637_1(y) VALUES(new.z+10000);
    END;
    INSERT INTO va69637_2 VALUES(123);
    SELECT * FROM ta69637_1;
  }
} {1 124 2 10123}



finish_test