summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2018-07-25 08:00:11 +0200
committerGitHub <noreply@github.com>2018-07-25 08:00:11 +0200
commitac25dd1f8d48accc765c05aebb47c427e51f3255 (patch)
tree0d87ea030e749a68a27f510a3c3ed041f5f2ddba /django/db
parent6429961418b0da70e915fcb61f4cf41977cf818a (diff)
Fixed #29569 -- Fixed Cast() with AutoField and BigAutoField.
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/mysql/operations.py2
-rw-r--r--django/db/backends/oracle/operations.py2
-rw-r--r--django/db/backends/postgresql/operations.py4
3 files changed, 8 insertions, 0 deletions
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py
index ddeb128d32..fd7b8153ba 100644
--- a/django/db/backends/mysql/operations.py
+++ b/django/db/backends/mysql/operations.py
@@ -18,6 +18,8 @@ class DatabaseOperations(BaseDatabaseOperations):
'PositiveIntegerField': (0, 4294967295),
}
cast_data_types = {
+ 'AutoField': 'signed integer',
+ 'BigAutoField': 'signed integer',
'CharField': 'char(%(max_length)s)',
'TextField': 'char',
'IntegerField': 'signed integer',
diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py
index 923b5d118d..62830476bf 100644
--- a/django/db/backends/oracle/operations.py
+++ b/django/db/backends/oracle/operations.py
@@ -52,6 +52,8 @@ END;
# Oracle doesn't support string without precision; use the max string size.
cast_char_field_without_max_length = 'NVARCHAR2(2000)'
cast_data_types = {
+ 'AutoField': 'NUMBER(11)',
+ 'BigAutoField': 'NUMBER(19)',
'TextField': cast_char_field_without_max_length,
}
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 80a28bce46..400f014a42 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -8,6 +8,10 @@ from django.db.backends.base.operations import BaseDatabaseOperations
class DatabaseOperations(BaseDatabaseOperations):
cast_char_field_without_max_length = 'varchar'
explain_prefix = 'EXPLAIN'
+ cast_data_types = {
+ 'AutoField': 'integer',
+ 'BigAutoField': 'bigint',
+ }
def unification_cast_sql(self, output_field):
internal_type = output_field.get_internal_type()