Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: David Turoň <Turon(dot)David(at)seznam(dot)cz>, edouard(dot)hibon(at)free(dot)fr, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist
Date: 2022-08-11 13:53:33
Message-ID: 482921.1660226013@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> čt 11. 8. 2022 v 12:17 odesílatel David Turoň <Turon(dot)David(at)seznam(dot)cz>
> napsal:
>> Is bug that function with anycompatiblearray didn't accept anyarray data
>> type?

> and yes - anyarray type is distinct from anycompatiblearray
> so you can write
> create or replace function fx(anyarray, anyarray, anycompatiblearray,
> anycompatiblearray) that means

Yeah. We could introduce a cast from anyarray to anycompatiblearray,
but I fear it'd play hob with the ability to use both polymorphic
families in one function signature.

More to the point, though, the casts are required here in any case.
Pre-v14, you got a different error, but it was still an error.
Neither in principle nor in practice would it be safe to pass
pg_stats.most_common_vals to array_position() without any cast.
array_position expects the array's element type to match the type
of its second argument, and will probably crash if it doesn't.
So forcing most_common_vals to flat text and then to text[] is
essential to unify the incompatible types found in pg_stat.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2022-08-11 14:17:45 Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE
Previous Message Tom Lane 2022-08-11 13:37:08 Re: BUG #17579: 15beta2: strange error when trying to use MERGE statement as a CTE