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

Overview
Comment:Insert a value in place of NULL in an INTEGER PRIMARY KEY, even if the IPK column is omitted from the VALUES list in the INSERT statement.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4d1b506594354cd6697416420808b51470f72a4f
User & Date: drh 2013-01-19 19:49:15.010
Context
2013-01-20
00:07
Enable the AUTOINCREMENT feature. check-in: 5442b20bf6 user: drh tags: trunk
2013-01-19
20:07
Change the lsm file-format to allow a small number of blocks belonging to the oldest segment in the database to be moved without modifying their content. This makes it easier to compact a database file to the minimum required size. check-in: 09251cee6a user: dan tags: block-redirects
19:49
Insert a value in place of NULL in an INTEGER PRIMARY KEY, even if the IPK column is omitted from the VALUES list in the INSERT statement. check-in: 4d1b506594 user: drh tags: trunk
16:14
Inserting NULL into a INTEGER PRIMARY KEY fills that key with the next available integer value. The sqlite4_last_insert_rowid() function now works for those cases. check-in: 697ee9faad user: drh tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/insert.c.
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
      sqlite4VdbeAddOp3(v, OP_Column, srcTab, j, regContent+i);
    }else if( pSelect ){
      sqlite4VdbeAddOp2(v, OP_SCopy, regFromSelect+j, regContent+i);
    }else{
      assert( pSelect==0 ); /* Otherwise useTempTable is true */
      sqlite4ExprCodeAndCache(pParse, pList->a[j].pExpr, regContent+i);
    }
    if( j==iIntPKCol ){
      int a1;
      a1 = sqlite4VdbeAddOp1(v, OP_NotNull, regContent+i);
      sqlite4VdbeAddOp2(v, OP_NewRowid, baseCur, regContent+i);
      sqlite4VdbeJumpHere(v, a1);
    }
  }








|







873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
      sqlite4VdbeAddOp3(v, OP_Column, srcTab, j, regContent+i);
    }else if( pSelect ){
      sqlite4VdbeAddOp2(v, OP_SCopy, regFromSelect+j, regContent+i);
    }else{
      assert( pSelect==0 ); /* Otherwise useTempTable is true */
      sqlite4ExprCodeAndCache(pParse, pList->a[j].pExpr, regContent+i);
    }
    if( i==iIntPKCol ){
      int a1;
      a1 = sqlite4VdbeAddOp1(v, OP_NotNull, regContent+i);
      sqlite4VdbeAddOp2(v, OP_NewRowid, baseCur, regContent+i);
      sqlite4VdbeJumpHere(v, a1);
    }
  }