summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/polymorphism.sql
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-12-01 12:44:28 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2011-12-01 12:44:28 -0500
commitefb74237937a95de3e933c807861bf70ae0149ce (patch)
tree80b7c8d0e446de10d5340cc902b77571f6f084f2 /src/test/regress/sql/polymorphism.sql
parent83c461e8fa158130f885dc4570217f49cfd61f55 (diff)
Fix getTypeIOParam to support type record[].
Since record[] uses array_in, it needs to have its element type passed as typioparam. In HEAD and 9.1, this fix essentially reverts commit 9bc933b2125a5358722490acbc50889887bf7680, which was a hack that is no longer needed since domains don't set their typelem anymore. Before that, adjust the logic so that only domains are excluded from being treated like arrays, rather than assuming that only base types should be included. Add a regression test to demonstrate the need for this. Per report from Maxim Boguk. Back-patch to 8.4, where type record[] was added.
Diffstat (limited to 'src/test/regress/sql/polymorphism.sql')
-rw-r--r--src/test/regress/sql/polymorphism.sql15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql
index 2baebe93235..67b3f336ae1 100644
--- a/src/test/regress/sql/polymorphism.sql
+++ b/src/test/regress/sql/polymorphism.sql
@@ -392,6 +392,21 @@ select f1, sql_if(f1 > 0, bleat(f1), bleat(f1 + 1)) from int4_tbl;
select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
+-- another sort of polymorphic aggregate
+
+CREATE AGGREGATE array_cat_accum (anyarray)
+(
+ sfunc = array_cat,
+ stype = anyarray,
+ initcond = '{}'
+);
+
+SELECT array_cat_accum(i)
+FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
+
+SELECT array_cat_accum(i)
+FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i);
+
-- another kind of polymorphic aggregate
create function add_group(grp anyarray, ad anyelement, size integer)