Skip to content

Commit 97f73a9

Browse files
committed
Work around cross-version-upgrade issues created by commit 9e38c2b.
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/1401824.1604537031@sss.pgh.pa.us Discussion: https://postgr.es/m/E1kaQ2c-0005lx-Eg@gemulon.postgresql.org
1 parent 72d1727 commit 97f73a9

File tree

2 files changed

+29
-24
lines changed

2 files changed

+29
-24
lines changed

src/test/regress/expected/polymorphism.out

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -729,24 +729,24 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
729729
(5 rows)
730730

731731
-- another sort of polymorphic aggregate
732-
CREATE AGGREGATE array_cat_accum (anycompatiblearray)
732+
CREATE AGGREGATE array_larger_accum (anyarray)
733733
(
734-
sfunc = array_cat,
735-
stype = anycompatiblearray,
734+
sfunc = array_larger,
735+
stype = anyarray,
736736
initcond = '{}'
737737
);
738-
SELECT array_cat_accum(i)
738+
SELECT array_larger_accum(i)
739739
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
740-
array_cat_accum
741-
-----------------
742-
{1,2,3,4}
740+
array_larger_accum
741+
--------------------
742+
{3,4}
743743
(1 row)
744744

745-
SELECT array_cat_accum(i)
745+
SELECT array_larger_accum(i)
746746
FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i);
747-
array_cat_accum
748-
-----------------------------------
749-
{"(1,2)","(3,4)","(5,6)","(7,8)"}
747+
array_larger_accum
748+
--------------------
749+
{"(5,6)","(7,8)"}
750750
(1 row)
751751

752752
-- another kind of polymorphic aggregate
@@ -786,16 +786,18 @@ create aggregate build_group(int8, integer) (
786786
STYPE = int8[]
787787
);
788788
-- check proper resolution of data types for polymorphic transfn/finalfn
789-
create function first_el(anycompatiblearray) returns anycompatible as
789+
create function first_el_transfn(anyarray, anyelement) returns anyarray as
790+
'select $1 || $2' language sql immutable;
791+
create function first_el(anyarray) returns anyelement as
790792
'select $1[1]' language sql strict immutable;
791793
create aggregate first_el_agg_f8(float8) (
792794
SFUNC = array_append,
793795
STYPE = float8[],
794796
FINALFUNC = first_el
795797
);
796-
create aggregate first_el_agg_any(anycompatible) (
797-
SFUNC = array_append,
798-
STYPE = anycompatiblearray,
798+
create aggregate first_el_agg_any(anyelement) (
799+
SFUNC = first_el_transfn,
800+
STYPE = anyarray,
799801
FINALFUNC = first_el
800802
);
801803
select first_el_agg_f8(x::float8) from generate_series(1,10) x;

src/test/regress/sql/polymorphism.sql

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -498,17 +498,17 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
498498

499499
-- another sort of polymorphic aggregate
500500

501-
CREATE AGGREGATE array_cat_accum (anycompatiblearray)
501+
CREATE AGGREGATE array_larger_accum (anyarray)
502502
(
503-
sfunc = array_cat,
504-
stype = anycompatiblearray,
503+
sfunc = array_larger,
504+
stype = anyarray,
505505
initcond = '{}'
506506
);
507507

508-
SELECT array_cat_accum(i)
508+
SELECT array_larger_accum(i)
509509
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
510510

511-
SELECT array_cat_accum(i)
511+
SELECT array_larger_accum(i)
512512
FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i);
513513

514514
-- another kind of polymorphic aggregate
@@ -549,7 +549,10 @@ create aggregate build_group(int8, integer) (
549549

550550
-- check proper resolution of data types for polymorphic transfn/finalfn
551551

552-
create function first_el(anycompatiblearray) returns anycompatible as
552+
create function first_el_transfn(anyarray, anyelement) returns anyarray as
553+
'select $1 || $2' language sql immutable;
554+
555+
create function first_el(anyarray) returns anyelement as
553556
'select $1[1]' language sql strict immutable;
554557

555558
create aggregate first_el_agg_f8(float8) (
@@ -558,9 +561,9 @@ create aggregate first_el_agg_f8(float8) (
558561
FINALFUNC = first_el
559562
);
560563

561-
create aggregate first_el_agg_any(anycompatible) (
562-
SFUNC = array_append,
563-
STYPE = anycompatiblearray,
564+
create aggregate first_el_agg_any(anyelement) (
565+
SFUNC = first_el_transfn,
566+
STYPE = anyarray,
564567
FINALFUNC = first_el
565568
);
566569

0 commit comments

Comments
 (0)