0002-make-some-array-functions-use-anycompatible.patch
text/x-diff
Filename: 0002-make-some-array-functions-use-anycompatible.patch
Type: text/x-diff
Part: 1
Message:
Re: Compatible defaults for LEAD/LAG
Patch
Format: unified
Series: patch 0002
| File | + | − |
|---|---|---|
| src/include/catalog/pg_operator.dat | 6 | 6 |
| src/include/catalog/pg_proc.dat | 15 | 14 |
| src/test/regress/expected/polymorphism.out | 5 | 5 |
| src/test/regress/sql/polymorphism.sql | 5 | 5 |
diff --git a/src/include/catalog/pg_operator.dat b/src/include/catalog/pg_operator.dat
index 7cc812adda..c3377ebe46 100644
--- a/src/include/catalog/pg_operator.dat
+++ b/src/include/catalog/pg_operator.dat
@@ -168,14 +168,14 @@
oprcode => 'textnename', oprrest => 'neqsel', oprjoin => 'neqjoinsel' },
{ oid => '349', descr => 'append element onto end of array',
- oprname => '||', oprleft => 'anyarray', oprright => 'anyelement',
- oprresult => 'anyarray', oprcode => 'array_append' },
+ oprname => '||', oprleft => 'anycompatiblearray', oprright => 'anycompatible',
+ oprresult => 'anycompatiblearray', oprcode => 'array_append' },
{ oid => '374', descr => 'prepend element onto front of array',
- oprname => '||', oprleft => 'anyelement', oprright => 'anyarray',
- oprresult => 'anyarray', oprcode => 'array_prepend' },
+ oprname => '||', oprleft => 'anycompatible', oprright => 'anycompatiblearray',
+ oprresult => 'anycompatiblearray', oprcode => 'array_prepend' },
{ oid => '375', descr => 'concatenate',
- oprname => '||', oprleft => 'anyarray', oprright => 'anyarray',
- oprresult => 'anyarray', oprcode => 'array_cat' },
+ oprname => '||', oprleft => 'anycompatiblearray', oprright => 'anycompatiblearray',
+ oprresult => 'anycompatiblearray', oprcode => 'array_cat' },
{ oid => '352', descr => 'equal',
oprname => '=', oprcanhash => 't', oprleft => 'xid', oprright => 'xid',
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 6e7832b0f4..b239b5d42d 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -1549,14 +1549,14 @@
proname => 'cardinality', prorettype => 'int4', proargtypes => 'anyarray',
prosrc => 'array_cardinality' },
{ oid => '378', descr => 'append element onto end of array',
- proname => 'array_append', proisstrict => 'f', prorettype => 'anyarray',
- proargtypes => 'anyarray anyelement', prosrc => 'array_append' },
+ proname => 'array_append', proisstrict => 'f', prorettype => 'anycompatiblearray',
+ proargtypes => 'anycompatiblearray anycompatible', prosrc => 'array_append' },
{ oid => '379', descr => 'prepend element onto front of array',
- proname => 'array_prepend', proisstrict => 'f', prorettype => 'anyarray',
- proargtypes => 'anyelement anyarray', prosrc => 'array_prepend' },
+ proname => 'array_prepend', proisstrict => 'f', prorettype => 'anycompatiblearray',
+ proargtypes => 'anycompatible anycompatiblearray', prosrc => 'array_prepend' },
{ oid => '383',
- proname => 'array_cat', proisstrict => 'f', prorettype => 'anyarray',
- proargtypes => 'anyarray anyarray', prosrc => 'array_cat' },
+ proname => 'array_cat', proisstrict => 'f', prorettype => 'anycompatiblearray',
+ proargtypes => 'anycompatiblearray anycompatiblearray', prosrc => 'array_cat' },
{ oid => '394', descr => 'split delimited text',
proname => 'string_to_array', proisstrict => 'f', prorettype => '_text',
proargtypes => 'text text', prosrc => 'text_to_array' },
@@ -1588,15 +1588,15 @@
proargtypes => 'anyarray anyarray', prosrc => 'array_smaller' },
{ oid => '3277', descr => 'returns an offset of value in array',
proname => 'array_position', proisstrict => 'f', prorettype => 'int4',
- proargtypes => 'anyarray anyelement', prosrc => 'array_position' },
+ proargtypes => 'anycompatiblearray anycompatible', prosrc => 'array_position' },
{ oid => '3278',
descr => 'returns an offset of value in array with start index',
proname => 'array_position', proisstrict => 'f', prorettype => 'int4',
- proargtypes => 'anyarray anyelement int4', prosrc => 'array_position_start' },
+ proargtypes => 'anycompatiblearray anycompatible int4', prosrc => 'array_position_start' },
{ oid => '3279',
descr => 'returns an array of offsets of some value in array',
proname => 'array_positions', proisstrict => 'f', prorettype => '_int4',
- proargtypes => 'anyarray anyelement', prosrc => 'array_positions' },
+ proargtypes => 'anycompatiblearray anycompatible', prosrc => 'array_positions' },
{ oid => '1191', descr => 'array subscripts generator',
proname => 'generate_subscripts', prorows => '1000', proretset => 't',
prorettype => 'int4', proargtypes => 'anyarray int4 bool',
@@ -1621,11 +1621,11 @@
proargtypes => 'internal', prosrc => 'array_unnest_support' },
{ oid => '3167',
descr => 'remove any occurrences of an element from an array',
- proname => 'array_remove', proisstrict => 'f', prorettype => 'anyarray',
- proargtypes => 'anyarray anyelement', prosrc => 'array_remove' },
+ proname => 'array_remove', proisstrict => 'f', prorettype => 'anycompatiblearray',
+ proargtypes => 'anycompatiblearray anycompatible', prosrc => 'array_remove' },
{ oid => '3168', descr => 'replace any occurrences of an element in an array',
- proname => 'array_replace', proisstrict => 'f', prorettype => 'anyarray',
- proargtypes => 'anyarray anyelement anyelement', prosrc => 'array_replace' },
+ proname => 'array_replace', proisstrict => 'f', prorettype => 'anycompatiblearray',
+ proargtypes => 'anycompatiblearray anycompatible anycompatible', prosrc => 'array_replace' },
{ oid => '2333', descr => 'aggregate transition function',
proname => 'array_agg_transfn', proisstrict => 'f', prorettype => 'internal',
proargtypes => 'internal anynonarray', prosrc => 'array_agg_transfn' },
@@ -1651,7 +1651,8 @@
{ oid => '3218',
descr => 'bucket number of operand given a sorted array of bucket lower bounds',
proname => 'width_bucket', prorettype => 'int4',
- proargtypes => 'anyelement anyarray', prosrc => 'width_bucket_array' },
+ proargtypes => 'anycompatible anycompatiblearray',
+ prosrc => 'width_bucket_array' },
{ oid => '3816', descr => 'array typanalyze',
proname => 'array_typanalyze', provolatile => 's', prorettype => 'bool',
proargtypes => 'internal', prosrc => 'array_typanalyze' },
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out
index 1ff40764d9..2c3bb0a60b 100644
--- a/src/test/regress/expected/polymorphism.out
+++ b/src/test/regress/expected/polymorphism.out
@@ -729,10 +729,10 @@ 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_cat_accum (anycompatiblearray)
(
sfunc = array_cat,
- stype = anyarray,
+ stype = anycompatiblearray,
initcond = '{}'
);
SELECT array_cat_accum(i)
@@ -786,16 +786,16 @@ create aggregate build_group(int8, integer) (
STYPE = int8[]
);
-- check proper resolution of data types for polymorphic transfn/finalfn
-create function first_el(anyarray) returns anyelement as
+create function first_el(anycompatiblearray) returns anycompatible 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(anyelement) (
+create aggregate first_el_agg_any(anycompatible) (
SFUNC = array_append,
- STYPE = anyarray,
+ STYPE = anycompatiblearray,
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 e5222f1f81..70a21c8978 100644
--- a/src/test/regress/sql/polymorphism.sql
+++ b/src/test/regress/sql/polymorphism.sql
@@ -498,10 +498,10 @@ 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_cat_accum (anycompatiblearray)
(
sfunc = array_cat,
- stype = anyarray,
+ stype = anycompatiblearray,
initcond = '{}'
);
@@ -549,7 +549,7 @@ create aggregate build_group(int8, integer) (
-- check proper resolution of data types for polymorphic transfn/finalfn
-create function first_el(anyarray) returns anyelement as
+create function first_el(anycompatiblearray) returns anycompatible as
'select $1[1]' language sql strict immutable;
create aggregate first_el_agg_f8(float8) (
@@ -558,9 +558,9 @@ create aggregate first_el_agg_f8(float8) (
FINALFUNC = first_el
);
-create aggregate first_el_agg_any(anyelement) (
+create aggregate first_el_agg_any(anycompatible) (
SFUNC = array_append,
- STYPE = anyarray,
+ STYPE = anycompatiblearray,
FINALFUNC = first_el
);