From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | David Turoň <Turon(dot)David(at)seznam(dot)cz> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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 11:08:01 |
Message-ID: | CAFj8pRCnxTiCBUCM1OsBdpUq1YsioeHb2EMyHRp8c9rYbKE+zA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi
čt 11. 8. 2022 v 12:17 odesílatel David Turoň <Turon(dot)David(at)seznam(dot)cz>
napsal:
> Hi,
>
> anycompatible didn't accept anyarray. Example from system catalogs:
>
> SELECT most_common_freqs[
> array_position(most_common_vals::text::text[],'range_ops'::text)
> ] * 100 AS occurrence_percent
> FROM pg_stats
> WHERE schemaname='pg_catalog' AND tablename ='pg_opfamily' AND
> attname='opfname';
> occurrence_percent
> --------------------
> 2.7397260069847107
>
>
> must be cast to text::text[] without cast:
> ERROR: function array_position(anyarray, text) does not exist
>
> Is bug that function with anycompatiblearray didn't accept anyarray data
> type?
>
This is interesting issue, because usual tables cannot to use polymorphic
types
(2022-08-11 13:01:20) postgres=# create table fpp(a anyarray);
ERROR: column "a" has pseudo-type anyarray
and yes - anyarray type is distinct from anycompatiblearray
so you can write
create or replace function fx(anyarray, anyarray, anycompatiblearray,
anycompatiblearray) that means
fx(T1, T1, T2, T2) -- like SELECT fx(ARRAY[current_date],
ARRAY[current_date + 1], ARRAY[1], ARRAY[1.1])
Regards
Pavel
p.s.
please, don't use top-posting in this mailing list
> regards, David Turoň
>
> ---------- Původní e-mail ----------
> Od: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> Komu: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
> Kopie: edouard(dot)hibon(at)free(dot)fr, PostgreSQL mailing lists <
> pgsql-bugs(at)lists(dot)postgresql(dot)org>
> Datum: 11. 8. 2022 12:02:17
> Předmět: Re: BUG #17206: the function array_cat(anyarray, anyarray) does
> not exist
>
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > On Thu, Sep 30, 2021 at 2:51 PM PG Bug reporting form <
> > noreply(at)postgresql(dot)org> wrote:
> >> I get the ERROR : the function array_cat(anyarray, anyarray) does not
> >> exist,
>
> > You may find this commit to be illuminating. Work was done in this area
> > for v14.
> >
> https://github.com/postgres/postgres/commit/97f73a978fc1aca59c6ad765548ce0096d95a923
>
> This one might be more so:
>
>
> https://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=9e38c2bb50
>
> Also see the very first item in the v14 compatibility notes:
>
> User-defined objects that reference certain built-in array functions
> along with their argument types must be recreated (Tom Lane)
>
> Specifically, array_append(), array_prepend(), array_cat(),
> array_position(), array_positions(), array_remove(), array_replace(),
> and width_bucket() used to take anyarray arguments but now take
> anycompatiblearray. Therefore, user-defined objects like aggregates
> and operators that reference those array function signatures must be
> dropped before upgrading, and recreated once the upgrade completes.
>
> regards, tom lane
>
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Andrea Spanu | 2022-08-11 11:28:28 | Psql utf8 |
Previous Message | David Turoň | 2022-08-11 10:17:10 | Re: BUG #17206: the function array_cat(anyarray, anyarray) does not exist |