field=None in get_or_create
|Reported by:||David Cramer||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
There is a problem when using get_or_create in the following situation:
MyModel.objects.get_or_create(field=None, field1=Hi, defaults=dict(x=1, y=2))
One would expect this to insert field as None, if one doesnt match where field is NULL (how else would propose to approach that?)
The problem is it treats the insert as NULL, but not the select.
This goes along the same lines in Django where None != NULL, which I believe it should.
Change History (5)
comment:2 Changed 9 years ago by
|Status:||new → closed|
|Summary:||[bug] field=None in get_or_create → field=None in get_or_create|
comment:3 follow-up: 4 Changed 12 months ago by