Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oM8d8-0007q8-0z for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Aug 2022 13:53:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oM8d6-00027h-Le for pgsql-bugs@arkaria.postgresql.org; Thu, 11 Aug 2022 13:53:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oM8d6-00027P-D2 for pgsql-bugs@lists.postgresql.org; Thu, 11 Aug 2022 13:53:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oM8d4-0004hk-6t for pgsql-bugs@lists.postgresql.org; Thu, 11 Aug 2022 13:53:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 27BDrXbL482922; Thu, 11 Aug 2022 09:53:33 -0400 From: Tom Lane To: Pavel Stehule cc: =?UTF-8?B?RGF2aWQgVHVyb8WI?= , edouard.hibon@free.fr, PostgreSQL mailing lists , "David G. Johnston" Subject: Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist In-reply-to: References: <17206-f0a6b77a0a7b8499@postgresql.org> <3266664.1633045937@sss.pgh.pa.us> <13T.5{S3.6C2WnHnPYu}.1YzDSc@scif.cz> Comments: In-reply-to Pavel Stehule message dated "Thu, 11 Aug 2022 13:08:01 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <482920.1660226013.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 11 Aug 2022 09:53:33 -0400 Message-ID: <482921.1660226013@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Pavel Stehule writes: > čt 11. 8. 2022 v 12:17 odesílatel David Turoň > 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