diff options
Diffstat (limited to 'lib/sqlalchemy/sql/functions.py')
-rw-r--r-- | lib/sqlalchemy/sql/functions.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql/functions.py b/lib/sqlalchemy/sql/functions.py index 9a9396fec..23bd9a568 100644 --- a/lib/sqlalchemy/sql/functions.py +++ b/lib/sqlalchemy/sql/functions.py @@ -689,7 +689,14 @@ class array_agg(GenericFunction): def __init__(self, *args, **kwargs): args = [_literal_as_binds(c) for c in args] - kwargs.setdefault('type_', self.type(_type_from_args(args))) + + 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['_parsed_args'] = args super(array_agg, self).__init__(*args, **kwargs) |