Two SQLite issues with bulk_insert
|Reported by:||akaariai||Owned by:||akaariai|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
SQLite + bulk_insert has two issues:
- If you insert objects with same values for all fields the objects will be collapsed.
- If you insert more than 500 objects and the objects have just a single field a SQLite limit will be hit.
The first issue is technically a data-loss issue. However it isn't likely to be hit - it means you are inserting exactly similar objects in a same batch, and that isn't likely. A backpatch to 1.4 seems to be in place as the fix is trivial: use UNION ALL instead of UNION when constructing the insert query.
Change History (5)
comment:2 Changed 2 years ago by Anssi Kääriäinen <akaariai@…>
- Resolution set to fixed
- Status changed from new to closed