﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32388	bulk_update() doesn't necessarily ignore duplicates.	Tim McCurrach	Tim McCurrach	"In the [https://docs.djangoproject.com/en/3.1/ref/models/querysets/#django.db.models.query.QuerySet.bulk_update docs for bulk_update] it says: ""If objs contains duplicates, only the first one is updated."" This is due to the way the query is constructed. 

However this is only true for each SQL update. And if there are duplicates that fall into different batches, they will both (or all) be used as part of the update.

=== To Reproduce Error ===

{{{
>>> m1 = MyModel.objects.get(id=1)
>>> m2 = MyModel.objects.get(id=1)
>>> m1.name=""a""
>>> m2.name=""b""
>>> MyModel.objects.bulk_update([m1, m2], ['name'], batch_size=1)
>>> MyModel.objects.get(id=1).name
'b' 

}}}

Whilst the above is an extreme example, it demonstrates the point. If a large number of objects are being updated, you cannot currently rely on the behaviour that only the first instance of a duplicate will affect the update. "	Cleanup/optimization	closed	Documentation	3.1	Normal	fixed			Accepted	0	0	0	0	1	0
