aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-08-01 01:14:43 +0000
committerdrh <drh@noemail.net>2013-08-01 01:14:43 +0000
commitb2b9d3d7586e93a6e860a27e42094bd670171a6b (patch)
treea381acf76f22585b4737fad99831ae14e1826ded /src/expr.c
parent4bd5f73fa09a7b5c8f1fe1dd39900811d15d1dab (diff)
downloadsqlite-b2b9d3d7586e93a6e860a27e42094bd670171a6b.tar.gz
sqlite-b2b9d3d7586e93a6e860a27e42094bd670171a6b.zip
Add the logic to keep partial indices up to date through DML statements and
when new partial indices are created. This new logic is untested except to verify that it does not interfere with full indices. FossilOrigin-Name: fb9044d15ad4fd6ae4a38858c0c0e6fe9d4faa25
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/expr.c b/src/expr.c
index 03258c32c..96c05dc3a 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -2362,15 +2362,20 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
/* Otherwise, fall thru into the TK_COLUMN case */
}
case TK_COLUMN: {
- if( pExpr->iTable<0 ){
- /* This only happens when coding check constraints */
- assert( pParse->ckBase>0 );
- inReg = pExpr->iColumn + pParse->ckBase;
- }else{
- inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
- pExpr->iColumn, pExpr->iTable, target,
- pExpr->op2);
+ int iTab = pExpr->iTable;
+ if( iTab<0 ){
+ if( pParse->ckBase>0 ){
+ /* Generating CHECK constraints or inserting into partial index */
+ inReg = pExpr->iColumn + pParse->ckBase;
+ break;
+ }else{
+ /* Deleting from a partial index */
+ iTab = pParse->iPartIdxTab;
+ }
}
+ inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
+ pExpr->iColumn, iTab, target,
+ pExpr->op2);
break;
}
case TK_INTEGER: {