diff options
author | nabil-rady <midorady9999@gmail.com> | 2023-03-02 00:13:00 +0200 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-03-08 11:52:57 +0100 |
commit | 32d4b61c313be5169137047e9fb3668da20a5d89 (patch) | |
tree | f6a0db331db2df5efb48f4112611b07947b712c2 /django | |
parent | 2396933ca99c6bfb53bda9e53968760316646e01 (diff) | |
download | django-32d4b61c313be5169137047e9fb3668da20a5d89.tar.gz |
Fixed #34370 -- Added integer fields validation as 64-bit on SQLite.
Diffstat (limited to 'django')
-rw-r--r-- | django/db/backends/sqlite3/operations.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/django/db/backends/sqlite3/operations.py b/django/db/backends/sqlite3/operations.py index bb84d52071..85ad804348 100644 --- a/django/db/backends/sqlite3/operations.py +++ b/django/db/backends/sqlite3/operations.py @@ -382,8 +382,15 @@ class DatabaseOperations(BaseDatabaseOperations): return "django_format_dtdelta(%s)" % ", ".join(fn_params) def integer_field_range(self, internal_type): - # SQLite doesn't enforce any integer constraints - return (None, None) + # SQLite doesn't enforce any integer constraints, but sqlite3 supports + # integers up to 64 bits. + if internal_type in [ + "PositiveBigIntegerField", + "PositiveIntegerField", + "PositiveSmallIntegerField", + ]: + return (0, 9223372036854775807) + return (-9223372036854775808, 9223372036854775807) def subtract_temporals(self, internal_type, lhs, rhs): lhs_sql, lhs_params = lhs |