SQLite

Check-in [17e9f658]
Login

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

Overview
Comment:In sqlite3GenerateIndexKey(), do not attempt to reuse column values from the previous index if the current index is a partial index as the partial index test may have changed those values. Ticket [a9efb42811fa41ee]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 17e9f65814264de9c35bc5ba94e0a66fbbf1200c00d33ab9a19a0b6f92bc685a
User & Date: drh 2019-11-02 13:32:50
Original Comment: In sqlite3GenerateIndexKey(), do not attempt to reuse column values from the previous index if the current index is a partial index as the partial index test may have corrupted those values. Ticket [a9efb42811fa41ee]
Context
2019-11-02
13:45
"STORED" is not actually a keyword. The parser looks for STORED as an ordinary identifier. (check-in: 167cd574 user: drh tags: trunk)
13:32
In sqlite3GenerateIndexKey(), do not attempt to reuse column values from the previous index if the current index is a partial index as the partial index test may have changed those values. Ticket [a9efb42811fa41ee] (check-in: 17e9f658 user: drh tags: trunk)
00:00
Restore the on-line ".help" for the ".explain" command in the CLI. (check-in: 28b8f103 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/delete.c.

914
915
916
917
918
919
920


921
922
923
924
925
926
927
  if( piPartIdxLabel ){
    if( pIdx->pPartIdxWhere ){
      *piPartIdxLabel = sqlite3VdbeMakeLabel(pParse);
      pParse->iSelfTab = iDataCur + 1;
      sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, 
                            SQLITE_JUMPIFNULL);
      pParse->iSelfTab = 0;


    }else{
      *piPartIdxLabel = 0;
    }
  }
  nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol);
  if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;







>
>







914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
  if( piPartIdxLabel ){
    if( pIdx->pPartIdxWhere ){
      *piPartIdxLabel = sqlite3VdbeMakeLabel(pParse);
      pParse->iSelfTab = iDataCur + 1;
      sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, 
                            SQLITE_JUMPIFNULL);
      pParse->iSelfTab = 0;
      pPrior = 0; /* Ticket a9efb42811fa41ee 2019-11-02;
                  ** pPartIdxWhere may have corrupted regPrior registers */
    }else{
      *piPartIdxLabel = 0;
    }
  }
  nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol);
  if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0;

Changes to test/index6.test.

474
475
476
477
478
479
480
481
482

















483
484
do_execsql_test index6-16.2 {
  SELECT 2 FROM t0 WHERE c0 >= c1;
} {}
do_execsql_test index6-16.3 {
  SELECT 3 FROM t0 WHERE c1 <= c0;
} {3}





















finish_test







|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
do_execsql_test index6-16.2 {
  SELECT 2 FROM t0 WHERE c0 >= c1;
} {}
do_execsql_test index6-16.3 {
  SELECT 3 FROM t0 WHERE c1 <= c0;
} {3}

# 2019-11-02
# Ticket https://sqlite.org/src/tktview/a9efb42811fa41ee286e8
db close
sqlite3 db :memory:
do_execsql_test index6-17.1 {
  CREATE TABLE t0(c0);
  CREATE INDEX i0 ON t0(0) WHERE c0 GLOB c0;
  INSERT INTO t0 VALUES (0);
  CREATE UNIQUE INDEX i1 ON t0(0);
  PRAGMA integrity_check;
} {ok}
do_execsql_test index6-17.2 {
  CREATE UNIQUE INDEX i2 ON t0(0);
  REPLACE INTO t0 VALUES(0);
  PRAGMA integrity_check;
} {ok}
do_execsql_test index6-17.3 {
  SELECT COUNT(*) FROM t0 WHERE t0.c0 GLOB t0.c0;
} {1}

finish_test