#17653: using id = 0 on get_or_create
-------------------------------------+-------------------------------------
Reporter: sylvain.lebon@… | Owner:
Type: Bug | krzysiumed
Component: Database layer | Status: assigned
(models, ORM) | Version: 1.3
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by akaariai):
Or the if connection.features.allows_primary_key_0 could be changed to if
connection.ops.validate_autopk_value(0).
Now that I look at it, it seems the name for the validate_autopk_value is
wrong, maybe check_autopk_value()?
I quickly tested primary key value of 0 using MySQL, and it seems to work.
It is the automatic PK which doesn't work for zero value. So, it really
isn't about allowing 0 as primary key value, it is about autopk values. I
am no MySQL expert, so I might be wrong here.
In general I am opposed to these boolean allows_primary_key_0 type
features. An external backend might disallow all non-positive values and
they have no way to express that with the boolean. Granted, this one isn't
particularly bad. And this really isn't this ticket's problem.
--
Ticket URL: <https://code.djangoproject.com/ticket/17653#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.