field=None in get_or_create
|Reported by:||dcramer||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 (2)
comment:1 Changed 7 years ago by ubernostrum
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset