Skip to content

Commit cea97d9

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 e455442 commit cea97d9

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

src/test/regress/expected/polymorphism.out

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -579,24 +579,24 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
579579
(5 rows)
580580

581581
-- another sort of polymorphic aggregate
582-
CREATE AGGREGATE array_cat_accum (anyarray)
582+
CREATE AGGREGATE array_larger_accum (anyarray)
583583
(
584-
sfunc = array_cat,
584+
sfunc = array_larger,
585585
stype = anyarray,
586586
initcond = '{}'
587587
);
588-
SELECT array_cat_accum(i)
588+
SELECT array_larger_accum(i)
589589
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
590-
array_cat_accum
591-
-----------------
592-
{1,2,3,4}
590+
array_larger_accum
591+
--------------------
592+
{3,4}
593593
(1 row)
594594

595-
SELECT array_cat_accum(i)
595+
SELECT array_larger_accum(i)
596596
FROM (VALUES (ARRAY[row(1,2),row(3,4)]), (ARRAY[row(5,6),row(7,8)])) as t(i);
597-
array_cat_accum
598-
-----------------------------------
599-
{"(1,2)","(3,4)","(5,6)","(7,8)"}
597+
array_larger_accum
598+
--------------------
599+
{"(5,6)","(7,8)"}
600600
(1 row)
601601

602602
-- another kind of polymorphic aggregate
@@ -636,6 +636,8 @@ create aggregate build_group(int8, integer) (
636636
STYPE = int8[]
637637
);
638638
-- check proper resolution of data types for polymorphic transfn/finalfn
639+
create function first_el_transfn(anyarray, anyelement) returns anyarray as
640+
'select $1 || $2' language sql immutable;
639641
create function first_el(anyarray) returns anyelement as
640642
'select $1[1]' language sql strict immutable;
641643
create aggregate first_el_agg_f8(float8) (
@@ -644,7 +646,7 @@ create aggregate first_el_agg_f8(float8) (
644646
FINALFUNC = first_el
645647
);
646648
create aggregate first_el_agg_any(anyelement) (
647-
SFUNC = array_append,
649+
SFUNC = first_el_transfn,
648650
STYPE = anyarray,
649651
FINALFUNC = first_el
650652
);

src/test/regress/sql/polymorphism.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,17 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
394394

395395
-- another sort of polymorphic aggregate
396396

397-
CREATE AGGREGATE array_cat_accum (anyarray)
397+
CREATE AGGREGATE array_larger_accum (anyarray)
398398
(
399-
sfunc = array_cat,
399+
sfunc = array_larger,
400400
stype = anyarray,
401401
initcond = '{}'
402402
);
403403

404-
SELECT array_cat_accum(i)
404+
SELECT array_larger_accum(i)
405405
FROM (VALUES (ARRAY[1,2]), (ARRAY[3,4])) as t(i);
406406

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

410410
-- another kind of polymorphic aggregate
@@ -445,6 +445,9 @@ create aggregate build_group(int8, integer) (
445445

446446
-- check proper resolution of data types for polymorphic transfn/finalfn
447447

448+
create function first_el_transfn(anyarray, anyelement) returns anyarray as
449+
'select $1 || $2' language sql immutable;
450+
448451
create function first_el(anyarray) returns anyelement as
449452
'select $1[1]' language sql strict immutable;
450453

@@ -455,7 +458,7 @@ create aggregate first_el_agg_f8(float8) (
455458
);
456459

457460
create aggregate first_el_agg_any(anyelement) (
458-
SFUNC = array_append,
461+
SFUNC = first_el_transfn,
459462
STYPE = anyarray,
460463
FINALFUNC = first_el
461464
);

0 commit comments

Comments
 (0)