diff options
| author | Tom Lane | 2008-12-14 19:45:52 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-12-14 19:45:52 +0000 |
| commit | a9d5f30be328fb83f0667b8a60df00a30d934fb2 (patch) | |
| tree | d552f96a1f72d1821d222b3653a457e8e7e9f294 /src/test | |
| parent | b8753e5955db8735107eb769fa0004b9f28a0c4e (diff) | |
Restore enforce_generic_type_consistency's pre-8.3 behavior of allowing an
actual argument type of ANYARRAY to match an argument declared ANYARRAY,
so long as ANYELEMENT etc aren't used. I had overlooked the fact that this
is a possible case while fixing bug #3852; but it is possible because
pg_statistic contains columns declared ANYARRAY. Per gripe from Corey Horton.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/polymorphism.out | 11 | ||||
| -rw-r--r-- | src/test/regress/sql/polymorphism.sql | 7 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/regress/expected/polymorphism.out b/src/test/regress/expected/polymorphism.out index 340b7c0f973..69e0ea47463 100644 --- a/src/test/regress/expected/polymorphism.out +++ b/src/test/regress/expected/polymorphism.out @@ -613,6 +613,17 @@ create aggregate build_group(int8, integer) ( SFUNC = add_group, STYPE = int8[] ); +-- check that we can apply functions taking ANYARRAY to pg_stats +select distinct array_ndims(histogram_bounds) from pg_stats +where histogram_bounds is not null; + array_ndims +------------- + 1 +(1 row) + +-- such functions must protect themselves if varying element type isn't OK +select max(histogram_bounds) from pg_stats; +ERROR: cannot compare arrays of different element types -- test variadic polymorphic functions create function myleast(variadic anyarray) returns anyelement as $$ select min($1[i]) from generate_subscripts($1,1) g(i) diff --git a/src/test/regress/sql/polymorphism.sql b/src/test/regress/sql/polymorphism.sql index 56f90c597a8..6c7b1813f94 100644 --- a/src/test/regress/sql/polymorphism.sql +++ b/src/test/regress/sql/polymorphism.sql @@ -427,6 +427,13 @@ create aggregate build_group(int8, integer) ( STYPE = int8[] ); +-- check that we can apply functions taking ANYARRAY to pg_stats +select distinct array_ndims(histogram_bounds) from pg_stats +where histogram_bounds is not null; + +-- such functions must protect themselves if varying element type isn't OK +select max(histogram_bounds) from pg_stats; + -- test variadic polymorphic functions create function myleast(variadic anyarray) returns anyelement as $$ |
