diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-22 11:13:54 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2018-08-22 11:15:00 -0400 |
| commit | 202108b6550d2e89b85b617a3f76654562eba6ef (patch) | |
| tree | a0cad4b7115122f7fd29d93ff4d3a3e8b630f0b8 /lib/sqlalchemy/sql | |
| parent | 08dd649e7e4048b8d8e723d5e00835b373e0b85c (diff) | |
| download | sqlalchemy-202108b6550d2e89b85b617a3f76654562eba6ef.tar.gz | |
Pass desired array type from pg.array_agg to functions.array_agg
Fixed the :func:`.postgresql.array_agg` function, which is a slightly
altered version of the usual :func:`.functions.array_agg` function, to also
accept an incoming "type" argument without forcing an ARRAY around it,
essentially the same thing that was fixed for the generic function in 1.1
in :ticket:`4107`.
Fixes: #4324
Change-Id: I399a29f59c945a217cdd22c65ff0325edea8ea65
(cherry picked from commit 52a3f5b7635583ae6feb084b1db654b9c65caec2)
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/functions.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 78aeb3a01..5e2e3ec1a 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -690,13 +690,14 @@ class array_agg(GenericFunction): def __init__(self, *args, **kwargs): args = [_literal_as_binds(c) for c in args] + default_array_type = kwargs.pop('_default_array_type', sqltypes.ARRAY) if 'type_' not in kwargs: type_from_args = _type_from_args(args) if isinstance(type_from_args, sqltypes.ARRAY): kwargs['type_'] = type_from_args else: - kwargs['type_'] = sqltypes.ARRAY(type_from_args) + kwargs['type_'] = default_array_type(type_from_args) kwargs['_parsed_args'] = args super(array_agg, self).__init__(*args, **kwargs) |
