#27979: Using F() to save negative integers in unsigned columns on MySQL should raise IntegrityError rather than OperationalError -------------------------------------+------------------------------------- Reporter: Chris Dary | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database layer | Version: 1.10 (models, ORM) | Severity: Normal | Resolution: Keywords: db, mysql, | Triage Stage: Accepted exceptions, OperationalError | Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Tim Graham):
* type: Bug => Cleanup/optimization * stage: Unreviewed => Accepted Comment: I can't reproduce the unwrapped exception (I'm seeing `django.db.utils.OperationalError: (1690, "BIGINT UNSIGNED value is out of range in '(`test_django`.`model_fields_positiveintegermodel`.`value` - 1)'")` for the attached test before the fix is applied), however, to be consistent with the behavior of other databases, I think this should raise `IntegrityError` rather than `OperationalError`. The attached patch needs to skip the test on databases that don't enforce the positive constraint (SQLite) as well as on MySQL, if strict mode is disabled. -- Ticket URL: <https://code.djangoproject.com/ticket/27979#comment:4> 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 unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.cfb982627d573d46f0f1c9916e2ec427%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.