/ Check-in [c9af2f71]
Login

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

Overview
Comment:Pull in the change that causes VACUUM to preserve rowid values.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | apple-osx
Files: files | file ages | folders
SHA3-256: c9af2f71bf1bc92a006d9053b0107a529b45e5a0b7f6e442a8e4db96678b53ac
User & Date: drh 2019-02-07 19:28:27
Context
2019-02-08
14:59
Merge the fix for ticket [4e8e4857d32d401f], so that this branch now contains release 3.27.1 plus the extra patch to preserve ROWID values on VACUUM. check-in: 0cdae60e user: drh tags: apple-osx
2019-02-07
19:28
Pull in the change that causes VACUUM to preserve rowid values. check-in: c9af2f71 user: drh tags: apple-osx
19:07
Change VACUUM so that it preserves ROWID values. check-in: 49e5d11d user: drh tags: trunk
18:49
Merge the offical 3.27.0 release. check-in: 62829164 user: drh tags: apple-osx
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/insert.c.

  2343   2343         addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
  2344   2344         sqlite3VdbeVerifyAbortable(v, onError);
  2345   2345         addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
  2346   2346         VdbeCoverage(v);
  2347   2347         sqlite3RowidConstraint(pParse, onError, pDest);
  2348   2348         sqlite3VdbeJumpHere(v, addr2);
  2349   2349         autoIncStep(pParse, regAutoinc, regRowid);
  2350         -    }else if( pDest->pIndex==0 ){
         2350  +    }else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_Vacuum) ){
  2351   2351         addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
  2352   2352       }else{
  2353   2353         addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
  2354   2354         assert( (pDest->tabFlags & TF_Autoincrement)==0 );
  2355   2355       }
  2356   2356       sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
  2357   2357       if( db->mDbFlags & DBFLAG_Vacuum ){

Changes to test/e_vacuum.test.

   215    215   # entries in any tables that do not have an explicit INTEGER PRIMARY
   216    216   # KEY.
   217    217   #
   218    218   #   Tests e_vacuum-3.1.1 - 3.1.2 demonstrate that rowids can change when
   219    219   #   a database is VACUUMed. Tests e_vacuum-3.1.3 - 3.1.4 show that adding
   220    220   #   an INTEGER PRIMARY KEY column to a table stops this from happening.
   221    221   #
          222  +#   Update 2019-01-07:  Rowids are now preserved by VACUUM.
          223  +#
   222    224   do_execsql_test e_vacuum-3.1.1 {
   223    225     CREATE TABLE t4(x);
   224    226     INSERT INTO t4(x) VALUES('x');
   225    227     INSERT INTO t4(x) VALUES('y');
   226    228     INSERT INTO t4(x) VALUES('z');
   227    229     DELETE FROM t4 WHERE x = 'y';
   228    230     SELECT rowid, x FROM t4;
   229    231   } {1 x 3 z}
   230    232   do_execsql_test e_vacuum-3.1.2 {
   231    233     VACUUM;
   232    234     SELECT rowid, x FROM t4;
   233         -} {1 x 2 z}
          235  +} {1 x 3 z}
          236  +# Was: {1 x 2 z}
   234    237   
   235    238   do_execsql_test e_vacuum-3.1.3 {
   236    239     CREATE TABLE t5(x, y INTEGER PRIMARY KEY);
   237    240     INSERT INTO t5(x) VALUES('x');
   238    241     INSERT INTO t5(x) VALUES('y');
   239    242     INSERT INTO t5(x) VALUES('z');
   240    243     DELETE FROM t5 WHERE x = 'y';