summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2020-11-10 23:32:36 +0000
committerTom Lane2020-11-10 23:32:36 +0000
commit97f73a978fc1aca59c6ad765548ce0096d95a923 (patch)
tree06ebe64e9db2878fb69be04d50b7e9981cf014d7
parent72d172743e52f31bb874e3bbc07544b30bf0bb51 (diff)
Work around cross-version-upgrade issues created by commit 9e38c2bb5.
Summarily changing the STYPE of regression-test aggregates that depend on array_append or array_cat is an issue for the buildfarm's cross-version-upgrade tests, because those aggregates (as defined in the back branches) now won't load into HEAD. Although this seems like only a minimal risk for genuine user-defined aggregates, we need to do something for the buildfarm. Hence, adjust the aggregate definitions, in both HEAD and the back branches. Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/[email protected]
-rw-r--r--src/test/regress/expected/polymorphism.out32
-rw-r--r--src/test/regress/sql/polymorphism.sql21
2 files changed, 29 insertions, 24 deletions
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index 2c3bb0a60b0..f5dfdf617fd 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -729,24 +729,24 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
(5 rows)
-- another sort of polymorphic aggregate
-CREATE AGGREGATE array_cat_accum (anycompatiblearray)
+CREATE AGGREGATE array_larger_accum (anyarray)
(
- sfunc = array_cat,
- stype = anycompatiblearray,
+ sfunc = array_larger,
+ stype = anyarray,
initcond = '{}'
);
-SELECT array_cat_accum(i)
+SELECT array_larger_accum(i)
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
- array_cat_accum
------------------
- {1,2,3,4}
+ array_larger_accum
+--------------------
+ {3,4}
(1 row)
-SELECT array_cat_accum(i)
+SELECT array_larger_accum(i)
FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i);
- array_cat_accum
------------------------------------
- {"(1,2)","(3,4)","(5,6)","(7,8)"}
+ array_larger_accum
+--------------------
+ {"(5,6)","(7,8)"}
(1 row)
-- another kind of polymorphic aggregate
@@ -786,16 +786,18 @@ create aggregate build_group(int8, integer) (
STYPE = int8[]
);
-- check proper resolution of data types for polymorphic transfn/finalfn
-create function first_el(anycompatiblearray) returns anycompatible as
+create function first_el_transfn(anyarray, anyelement) returns anyarray as
+'select $1 || $2' language sql immutable;
+create function first_el(anyarray) returns anyelement as
'select $1[1]' language sql strict immutable;
create aggregate first_el_agg_f8(float8) (
SFUNC = array_append,
STYPE = float8[],
FINALFUNC = first_el
);
-create aggregate first_el_agg_any(anycompatible) (
- SFUNC = array_append,
- STYPE = anycompatiblearray,
+create aggregate first_el_agg_any(anyelement) (
+ SFUNC = first_el_transfn,
+ STYPE = anyarray,
FINALFUNC = first_el
);
select first_el_agg_f8(x::float8) from generate_series(1,10) x;
diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql
index 70a21c89780..ff517fea41a 100644
--- a/src/test/regress/sql/polymorphism.sql
+++ b/src/test/regress/sql/polymorphism.sql
@@ -498,17 +498,17 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
-- another sort of polymorphic aggregate
-CREATE AGGREGATE array_cat_accum (anycompatiblearray)
+CREATE AGGREGATE array_larger_accum (anyarray)
(
- sfunc = array_cat,
- stype = anycompatiblearray,
+ sfunc = array_larger,
+ stype = anyarray,
initcond = '{}'
);
-SELECT array_cat_accum(i)
+SELECT array_larger_accum(i)
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
-SELECT array_cat_accum(i)
+SELECT array_larger_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
@@ -549,7 +549,10 @@ create aggregate build_group(int8, integer) (
-- check proper resolution of data types for polymorphic transfn/finalfn
-create function first_el(anycompatiblearray) returns anycompatible as
+create function first_el_transfn(anyarray, anyelement) returns anyarray as
+'select $1 || $2' language sql immutable;
+
+create function first_el(anyarray) returns anyelement as
'select $1[1]' language sql strict immutable;
create aggregate first_el_agg_f8(float8) (
@@ -558,9 +561,9 @@ create aggregate first_el_agg_f8(float8) (
FINALFUNC = first_el
);
-create aggregate first_el_agg_any(anycompatible) (
- SFUNC = array_append,
- STYPE = anycompatiblearray,
+create aggregate first_el_agg_any(anyelement) (
+ SFUNC = first_el_transfn,
+ STYPE = anyarray,
FINALFUNC = first_el
);