mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Ensure that all ON CONFLICT REPLACE indexes are sorted to the end of the list
of indexes for a table, even for weird cases where the same UNIQUE constraint occurs twice with the ON CONFLICT REPLACE clause only on the second one. This avoids an out-of-order contraint processing problem that can arise due to the optimization of check-in [469a62ca33081854]. FossilOrigin-Name: 1e3918ca2f2c1cfcfa44249b1d7b847d52cbb8d302a8d4a335c090cfdf22d7a1
This commit is contained in:
@@ -2250,6 +2250,10 @@ void sqlite3CompleteInsertion(
|
||||
assert( v!=0 );
|
||||
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
|
||||
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
||||
/* All REPLACE indexes are at the end of the list */
|
||||
assert( pIdx->onError!=OE_Replace
|
||||
|| pIdx->pNext==0
|
||||
|| pIdx->pNext->onError==OE_Replace );
|
||||
if( aRegIdx[i]==0 ) continue;
|
||||
if( pIdx->pPartIdxWhere ){
|
||||
sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2);
|
||||
|
||||
Reference in New Issue
Block a user