summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-09-29 14:50:51 -0400
committerTim Graham <timograham@gmail.com>2017-09-29 18:33:10 -0400
commitd6cec5f6ffd1b5dc906a85ecbb0ca8d11e6d494d (patch)
treee2cc4ecb11ddafb74dc3370a64fbe8204f508e55 /django
parenteff5f837c9dd887137a54475b3a5fcd968336f16 (diff)
[2.0.x] Fixed #27979 -- Made MySQL raise IntegrityError rather than OperationalError when saving negative numbers in PositiveInteger fields.
Backport of dd82f3327124fd2762cf6df2ac8c6380772bf127 from master
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/mysql/base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py
index 0e5c25fc23..f4bad47e06 100644
--- a/django/db/backends/mysql/base.py
+++ b/django/db/backends/mysql/base.py
@@ -57,7 +57,10 @@ class CursorWrapper:
Implemented as a wrapper, rather than a subclass, so that it isn't stuck
to the particular underlying representation returned by Connection.cursor().
"""
- codes_for_integrityerror = (1048,)
+ codes_for_integrityerror = (
+ 1048, # Column cannot be null
+ 1690, # BIGINT UNSIGNED value is out of range
+ )
def __init__(self, cursor):
self.cursor = cursor