/ Check-in [61d7d475]
Login

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

Overview
Comment:Fix a problem in OP_IdxDelete as used by REPLACE conflict resolution that comes up due to recent enhancements that reduce the work required for UNIQUE NOT NULL indices.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:61d7d4753f36932293c0eb1ca893b17d18355ad3
User & Date: drh 2013-11-11 00:43:21
Context
2013-11-11
01:42
Modify a HeapValidate assert in the Win32 native allocator. check-in: aaed7d1d user: mistachkin tags: trunk
00:43
Fix a problem in OP_IdxDelete as used by REPLACE conflict resolution that comes up due to recent enhancements that reduce the work required for UNIQUE NOT NULL indices. check-in: 61d7d475 user: drh tags: trunk
2013-11-10
00:03
Fix typo in comment and remove superfluous blank line. No changes to code. check-in: 023233f1 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

  4657   4657     pC = p->apCsr[pOp->p1];
  4658   4658     assert( pC!=0 );
  4659   4659     pCrsr = pC->pCursor;
  4660   4660     if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  4661   4661     if( ALWAYS(pCrsr!=0) ){
  4662   4662       r.pKeyInfo = pC->pKeyInfo;
  4663   4663       r.nField = (u16)pOp->p3;
  4664         -    r.flags = 0;
         4664  +    r.flags = UNPACKED_PREFIX_MATCH;
  4665   4665       r.aMem = &aMem[pOp->p2];
  4666   4666   #ifdef SQLITE_DEBUG
  4667   4667       { int i; for(i=0; i<r.nField; i++) assert( memIsValid(&r.aMem[i]) ); }
  4668   4668   #endif
  4669   4669       rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res);
  4670   4670       if( rc==SQLITE_OK && res==0 ){
  4671   4671         rc = sqlite3BtreeDelete(pCrsr);

Changes to test/conflict2.test.

   808    808   do_test conflict2-13.2 {
   809    809     execsql {
   810    810       REPLACE INTO t13 VALUES(3);
   811    811       COMMIT;
   812    812       SELECT * FROM t13;
   813    813     }
   814    814   } {1 3}
          815  +
          816  +# Test for an unreleased bug in the REPLACE conflict resolution
          817  +# discovered on 2013-11-09.  
          818  +#
          819  +do_execsql_test conflict2-14.1 {
          820  +  DROP TABLE IF EXISTS t1;
          821  +  CREATE TABLE t1(
          822  +    x TEXT PRIMARY KEY NOT NULL, 
          823  +    y TEXT NOT NULL,
          824  +    z INTEGER
          825  +  );
          826  +  INSERT INTO t1 VALUES('alpha','beta',1);
          827  +  CREATE UNIQUE INDEX t1xy ON t1(x,y);
          828  +  REPLACE INTO t1(x,y,z) VALUES('alpha','gamma',1);
          829  +  PRAGMA integrity_check;
          830  +  SELECT x,y FROM t1 INDEXED BY t1xy;
          831  +  SELECT x,y,z FROM t1 NOT INDEXED;
          832  +} {ok alpha gamma alpha gamma 1}
          833  +do_execsql_test conflict2-14.2 {
          834  +  DROP TABLE IF EXISTS t1;
          835  +  CREATE TABLE t1(
          836  +    x TEXT PRIMARY KEY NOT NULL, 
          837  +    y TEXT NOT NULL,
          838  +    z INTEGER
          839  +  ) WITHOUT ROWID;
          840  +  INSERT INTO t1 VALUES('alpha','beta',1);
          841  +  CREATE UNIQUE INDEX t1xy ON t1(x,y);
          842  +  REPLACE INTO t1(x,y,z) VALUES('alpha','gamma',1);
          843  +  PRAGMA integrity_check;
          844  +  SELECT x,y FROM t1 INDEXED BY t1xy;
          845  +  SELECT x,y,z FROM t1 NOT INDEXED;
          846  +} {ok alpha gamma alpha gamma 1}
          847  +
   815    848   
   816    849   
   817    850   finish_test