1
0
mirror of https://github.com/django/django.git synced 2025-10-26 15:16:09 +00:00

Fixed #32776 -- Added support for Array subqueries on PostgreSQL.

This commit is contained in:
Hannes Ljungberg
2020-11-20 21:35:04 +01:00
committed by Mariusz Felisiak
parent 49ca6bbc44
commit a06b977a91
5 changed files with 119 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
from django.contrib.postgres.fields import ArrayField
from django.db.models import Subquery
from django.utils.functional import cached_property
class ArraySubquery(Subquery):
template = 'ARRAY(%(subquery)s)'
def __init__(self, queryset, **kwargs):
super().__init__(queryset, **kwargs)
@cached_property
def output_field(self):
return ArrayField(self.query.output_field)