From 52a3f5b7635583ae6feb084b1db654b9c65caec2 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 22 Aug 2018 11:13:54 -0400 Subject: 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 --- lib/sqlalchemy/dialects/postgresql/ext.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/sqlalchemy/dialects/postgresql/ext.py') diff --git a/lib/sqlalchemy/dialects/postgresql/ext.py b/lib/sqlalchemy/dialects/postgresql/ext.py index 20ed0fc8d..71fb3cc5b 100644 --- a/lib/sqlalchemy/dialects/postgresql/ext.py +++ b/lib/sqlalchemy/dialects/postgresql/ext.py @@ -209,10 +209,11 @@ static/sql-createtable.html#SQL-CREATETABLE-EXCLUDE def array_agg(*arg, **kw): """PostgreSQL-specific form of :class:`.array_agg`, ensures return type is :class:`.postgresql.ARRAY` and not - the plain :class:`.types.ARRAY`. + the plain :class:`.types.ARRAY`, unless an explicit ``type_`` + is passed. .. versionadded:: 1.1 """ - kw['type_'] = ARRAY(functions._type_from_args(arg)) + kw['_default_array_type'] = ARRAY return functions.func.array_agg(*arg, **kw) -- cgit v1.2.1