1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-10 01:02:56 +03:00

Add code to maintain indexes with expression arguments across DELETE, INSERT,

and UPDATE statements.  Legacy tests pass, but the new code paths are still
largely untested.  The query planner currently makes no effort to use
expression indexes.

FossilOrigin-Name: efaabdb71626bdc03768e87e186c72f6f3da75b2
This commit is contained in:
drh
2015-08-25 16:57:52 +00:00
parent a514b8eb0c
commit 1f9ca2c84c
14 changed files with 146 additions and 67 deletions

View File

@@ -272,7 +272,9 @@ void sqlite3Update(
/* There is one entry in the aRegIdx[] array for each index on the table
** being updated. Fill in aRegIdx[] with a register number that will hold
** the key for accessing each index.
** the key for accessing each index.
**
** FIXME: Be smarter about omitting indexes that use expressions.
*/
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
int reg;
@@ -281,7 +283,8 @@ void sqlite3Update(
}else{
reg = 0;
for(i=0; i<pIdx->nKeyCol; i++){
if( aXRef[pIdx->aiColumn[i]]>=0 ){
i16 iIdxCol = pIdx->aiColumn[i];
if( iIdxCol<0 || aXRef[iIdxCol]>=0 ){
reg = ++pParse->nMem;
break;
}
@@ -381,6 +384,7 @@ void sqlite3Update(
if( pWInfo==0 ) goto update_cleanup;
okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass);
for(i=0; i<nPk; i++){
assert( pPk->aiColumn[i]>=(-1) );
sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pPk->aiColumn[i],
iPk+i);
}