summaryrefslogtreecommitdiff
path: root/test/sql
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-08-26 15:15:45 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2015-08-26 15:15:55 -0400
commitcfae9c2eaf0020be8d8acbe104cb693e0fee0796 (patch)
tree37e608da4c00e645b188341ff0a43b4bae42096b /test/sql
parent7024745a142e261efb6d878389d01a06673b655c (diff)
downloadsqlalchemy-cfae9c2eaf0020be8d8acbe104cb693e0fee0796.tar.gz
- Added support for the SQL-standard function :class:`.array_agg`,
which automatically returns an :class:`.Array` of the correct type and supports index / slice operations. As arrays are only supported on Postgresql at the moment, only actually works on Postgresql. fixes #3132
Diffstat (limited to 'test/sql')
-rw-r--r--test/sql/test_functions.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/sql/test_functions.py b/test/sql/test_functions.py
index ccc9b2dcd..f080046ff 100644
--- a/test/sql/test_functions.py
+++ b/test/sql/test_functions.py
@@ -1,8 +1,8 @@
-from sqlalchemy.testing import eq_
+from sqlalchemy.testing import eq_, is_
import datetime
from sqlalchemy import func, select, Integer, literal, DateTime, Table, \
Column, Sequence, MetaData, extract, Date, String, bindparam, \
- literal_column
+ literal_column, Array
from sqlalchemy.sql import table, column
from sqlalchemy import sql, util
from sqlalchemy.sql.compiler import BIND_TEMPLATES
@@ -489,6 +489,14 @@ class CompileTest(fixtures.TestBase, AssertsCompiledSQL):
MissingType().compile
)
+ def test_array_agg(self):
+ m = MetaData()
+ t = Table('t', m, Column('data', Integer))
+ expr = func.array_agg(t.c.data)
+ is_(expr.type._type_affinity, Array)
+ is_(expr.type.item_type._type_affinity, Integer)
+
+
class ExecuteTest(fixtures.TestBase):