/ Check-in [9f2e04d3]
Login

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

Overview
Comment:Remove an invalid assert() statement failing when VACUUMing a database that contains an index on a column explicitly declared "COLLATE BINARY".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9f2e04d3c3526b5ff60d941aa6d5446f602cab37cb93972937f39eefabd6868d
User & Date: dan 2017-03-23 17:03:35
Context
2017-03-23
17:22
Do not run test file autoanalyze1.test if OMIT_VIRTUALTABLE is defined. check-in: e1d06a57 user: dan tags: trunk
17:03
Remove an invalid assert() statement failing when VACUUMing a database that contains an index on a column explicitly declared "COLLATE BINARY". check-in: 9f2e04d3 user: dan tags: trunk
2017-03-22
12:51
Fix harmless compiler warnings in the shell. check-in: a7868297 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/insert.c.

2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
      ** If any of the indexed columns use a collation sequence other than
      ** BINARY, this optimization is disabled. This is because the user 
      ** might change the definition of a collation sequence and then run
      ** a VACUUM command. In that case keys may not be written in strictly
      ** sorted order.  */
      for(i=0; i<pSrcIdx->nColumn; i++){
        const char *zColl = pSrcIdx->azColl[i];
        assert( sqlite3_stricmp(sqlite3StrBINARY, zColl)!=0
                    || sqlite3StrBINARY==zColl );
        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
      }
      if( i==pSrcIdx->nColumn ){
        idxInsFlags = OPFLAG_USESEEKRESULT;
        sqlite3VdbeAddOp3(v, OP_Last, iDest, 0, -1);
      }
    }







<
<







2223
2224
2225
2226
2227
2228
2229


2230
2231
2232
2233
2234
2235
2236
      ** If any of the indexed columns use a collation sequence other than
      ** BINARY, this optimization is disabled. This is because the user 
      ** might change the definition of a collation sequence and then run
      ** a VACUUM command. In that case keys may not be written in strictly
      ** sorted order.  */
      for(i=0; i<pSrcIdx->nColumn; i++){
        const char *zColl = pSrcIdx->azColl[i];


        if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
      }
      if( i==pSrcIdx->nColumn ){
        idxInsFlags = OPFLAG_USESEEKRESULT;
        sqlite3VdbeAddOp3(v, OP_Last, iDest, 0, -1);
      }
    }

Changes to test/collateB.test.

9
10
11
12
13
14
15

16
17
18
19
20
21
22
..
55
56
57
58
59
60
61
62













63
#
#***********************************************************************
# Test cases for a crash bug.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl


do_execsql_test collateB-1.1 {
  CREATE TABLE t1(a INTEGER PRIMARY KEY);
  CREATE TABLE t2(b INTEGER PRIMARY KEY, x1 INT COLLATE NOCASE);
  CREATE TABLE t3(x2 INT);
  SELECT * FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1;
} {}
................................................................................
} {11 1 1 11 |}
do_execsql_test collateB-1.16 {
  SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
} {1 11 1 11 |}
do_execsql_test collateB-1.17 {
  SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
} {1 11 1 11 |}














finish_test







>







 








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

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
..
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
#***********************************************************************
# Test cases for a crash bug.
#

set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix collateB

do_execsql_test collateB-1.1 {
  CREATE TABLE t1(a INTEGER PRIMARY KEY);
  CREATE TABLE t2(b INTEGER PRIMARY KEY, x1 INT COLLATE NOCASE);
  CREATE TABLE t3(x2 INT);
  SELECT * FROM t3, t2, t1 WHERE x2=b AND x1=a AND a=1;
} {}
................................................................................
} {11 1 1 11 |}
do_execsql_test collateB-1.16 {
  SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
} {1 11 1 11 |}
do_execsql_test collateB-1.17 {
  SELECT *,'|' FROM t1, t2, t3 WHERE b=x2 AND a=x1 AND 1=a;
} {1 11 1 11 |}

#-------------------------------------------------------------------------
# Test an assert() failure that was occuring if an index were created
# on a column explicitly declared "COLLATE binary".
reset_db
do_execsql_test 2.1 {
  CREATE TABLE t4(a COLLATE binary);
  CREATE INDEX i4 ON t4(a);
  INSERT INTO t4 VALUES('one'), ('two'), ('three');
  VACUUM;
} 

integrity_check 2.2

finish_test