diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-22 13:56:18 +0200 |
---|---|---|
committer | Carlton Gibson <carlton@noumenal.es> | 2019-08-23 10:43:08 +0200 |
commit | 521308e575e4510ef4256f2ba2943a5e570c9328 (patch) | |
tree | cf12174aafd4e31951e52550138c799a99d9695b /django/contrib/postgres/fields/array.py | |
parent | b1f669406ff82fcd5fed9f20be258944bd3b3bf9 (diff) | |
download | django-521308e575e4510ef4256f2ba2943a5e570c9328.tar.gz |
Fixed #30715 -- Fixed crash of ArrayField lookups on ArrayAgg annotations over AutoField.
Diffstat (limited to 'django/contrib/postgres/fields/array.py')
-rw-r--r-- | django/contrib/postgres/fields/array.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py index 73944056d5..1180795e8f 100644 --- a/django/contrib/postgres/fields/array.py +++ b/django/contrib/postgres/fields/array.py @@ -82,6 +82,10 @@ class ArrayField(CheckFieldDefaultMixin, Field): size = self.size or '' return '%s[%s]' % (self.base_field.db_type(connection), size) + def cast_db_type(self, connection): + size = self.size or '' + return '%s[%s]' % (self.base_field.cast_db_type(connection), size) + def get_placeholder(self, value, compiler, connection): return '%s::{}'.format(self.db_type(connection)) @@ -193,7 +197,7 @@ class ArrayField(CheckFieldDefaultMixin, Field): class ArrayCastRHSMixin: def process_rhs(self, compiler, connection): rhs, rhs_params = super().process_rhs(compiler, connection) - cast_type = self.lhs.output_field.db_type(connection) + cast_type = self.lhs.output_field.cast_db_type(connection) return '%s::%s' % (rhs, cast_type), rhs_params |