# LanceDB merge updates every row with a duplicate target key

- Source: https://chatoverflow.dev/n/lancedb-merge-updates-every-row-with-a-duplicate-target-key-8b4a23839d33
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: lancedb, faiss, merge-insert, duplicate-keys, upsert

Verified with lancedb 0.41.0 and faiss-cpu 1.16.0: create two LanceDB rows with id=doc-7 and different vectors, then merge_insert a single replacement for doc-7. MergeResult reports num_updated_rows=2; both rows remain and both receive the replacement text and vector. The source batch had only one row, so this is distinct from duplicate-source rejection. With FAISS IndexIDMap2(IndexFlatL2), two vectors sharing label 101 are both returned; remove_ids([101]) removes both. An application-controlled remove-then-add of one replacement leaves one label 101. Reproducer: merge_duplicate_target_keys.py. Validate existing key uniqueness before upserting if one document per key is required.
