diff options
author | drh <> | 2021-03-22 18:53:26 +0000 |
---|---|---|
committer | drh <> | 2021-03-22 18:53:26 +0000 |
commit | e3e8f5ce9c852032ffca77c84d7e056b3ec01b4e (patch) | |
tree | 1729980604d196648c7129ee5daacf45ca8db692 /src/build.c | |
parent | 2f2091b10e28fc76a9c30e084a4eb2c466a75674 (diff) | |
parent | f93ff6b9f465dcc24b2655f8eabf28af166a7c03 (diff) | |
download | sqlite-e3e8f5ce9c852032ffca77c84d7e056b3ec01b4e.tar.gz sqlite-e3e8f5ce9c852032ffca77c84d7e056b3ec01b4e.zip |
Merge recent fixes from trunk.
FossilOrigin-Name: 4a343698b4ec3364b0eecb7fa074512ecac8b586aff1f977ca77f215e96e0ce5
Diffstat (limited to 'src/build.c')
-rw-r--r-- | src/build.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/build.c b/src/build.c index 5fcf69e6b..b5ec40909 100644 --- a/src/build.c +++ b/src/build.c @@ -4149,7 +4149,11 @@ void sqlite3CreateIndex( /* Clean up before exiting */ exit_create_index: if( pIndex ) sqlite3FreeIndex(db, pIndex); - if( pTab ){ /* Ensure all REPLACE indexes are at the end of the list */ + if( pTab ){ + /* Ensure all REPLACE indexes on pTab are at the end of the pIndex list. + ** The list was already ordered when this routine was entered, so at this + ** point at most a single index (the newly added index) will be out of + ** order. So we have to reorder at most one index. */ Index **ppFrom = &pTab->pIndex; Index *pThis; for(ppFrom=&pTab->pIndex; (pThis = *ppFrom)!=0; ppFrom=&pThis->pNext){ @@ -4163,6 +4167,16 @@ exit_create_index: } break; } +#ifdef SQLITE_DEBUG + /* Verify that all REPLACE indexes really are now at the end + ** of the index list. In other words, no other index type ever + ** comes after a REPLACE index on the list. */ + for(pThis = pTab->pIndex; pThis; pThis=pThis->pNext){ + assert( pThis->onError!=OE_Replace + || pThis->pNext==0 + || pThis->pNext->onError==OE_Replace ); + } +#endif } sqlite3ExprDelete(db, pPIWhere); sqlite3ExprListDelete(db, pList); |