Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Work around cross-version-upgrade issues created by commit 9e38c2bb5.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 10 Nov 2020 23:32:36 +0000 (18:32 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 10 Nov 2020 23:32:36 +0000 (18:32 -0500)
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

src/test/regress/expected/polymorphism.out
src/test/regress/sql/polymorphism.sql

index 986417a1881f362acf55ef41492bd01dbecfdb2c..72ad1f57025049ceb8d72d375fddf0480291b1bc 100644 (file)
@@ -579,24 +579,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 (anyarray)
+CREATE AGGREGATE array_larger_accum (anyarray)
 (
-    sfunc = array_cat,
+    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
@@ -636,6 +636,8 @@ create aggregate build_group(int8, integer) (
   STYPE = int8[]
 );
 -- check proper resolution of data types for polymorphic transfn/finalfn
+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) (
@@ -644,7 +646,7 @@ create aggregate first_el_agg_f8(float8) (
   FINALFUNC = first_el
 );
 create aggregate first_el_agg_any(anyelement) (
-  SFUNC = array_append,
+  SFUNC = first_el_transfn,
   STYPE = anyarray,
   FINALFUNC = first_el
 );
index 03606671d92b757533208e06ac4792ffa5567f9d..7332da09315a15ce5d961a882f140387bc7089f5 100644 (file)
@@ -394,17 +394,17 @@ select q2, sql_if(q2 > 0, q2, q2 + 1) from int8_tbl;
 
 -- another sort of polymorphic aggregate
 
-CREATE AGGREGATE array_cat_accum (anyarray)
+CREATE AGGREGATE array_larger_accum (anyarray)
 (
-    sfunc = array_cat,
+    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
@@ -445,6 +445,9 @@ create aggregate build_group(int8, integer) (
 
 -- check proper resolution of data types for polymorphic transfn/finalfn
 
+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;
 
@@ -455,7 +458,7 @@ create aggregate first_el_agg_f8(float8) (
 );
 
 create aggregate first_el_agg_any(anyelement) (
-  SFUNC = array_append,
+  SFUNC = first_el_transfn,
   STYPE = anyarray,
   FINALFUNC = first_el
 );