PG 14 - can't upgrade from a database using an aggregate with anyelement and anyarray

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема PG 14 - can't upgrade from a database using an aggregate with anyelement and anyarray
Дата
Msg-id 5c4ad9d6-e73a-a59c-6393-571fc69857e5@gmx.net
обсуждение исходный текст
Ответы Re: PG 14 - can't upgrade from a database using an aggregate with anyelement and anyarray  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

this aggregate can be created without problems on PG 13 and before:

   CREATE AGGREGATE array_accum(anyelement) (
       SFUNC = array_append,
       STYPE = anyarray,
       INITCOND = '{}'
   );

However, that fails with PG 14beta1 because array_append's parameter are now (anycompatiblearray, anycompatible) while
itused to be (anyarray, anyelement).
 

I guess this is a side-effect of:

> Allow some array functions to operate on a mix of compatible data
> types (Tom Lane)
>
> The functions are array_append() array_prepend(), array_cat(),
> array_position(), array_positions(), array_remove(), array_replace(),
> and width_bucket(). Previously only identical data types could be
> used.

On a database with the above aggregate, pg_upgrade fails with the following error:

     pg_restore: creating AGGREGATE "public.array_accum("anyelement")"
     pg_restore: while PROCESSING TOC:
     pg_restore: from TOC entry 2646; 1255 16552 AGGREGATE array_accum("anyelement") thomas
     pg_restore: error: could not execute query: ERROR:  function array_append(anyarray, anyelement) does not exist
     Command was: CREATE AGGREGATE "public"."array_accum"("anyelement") (
         SFUNC = "array_append",
         STYPE = "anyarray",
         INITCOND = '{}'
     );

The problem is, that the version that works in PG 14:

   CREATE AGGREGATE array_accum(anycompatible) (
       SFUNC = array_append,
       STYPE = anycompatiblearray,
       INITCOND = '{}'
   );

can't be created in PG 13 in preparation of the upgrade.

So the database can't be upgraded using pg_upgrade.

I am using PG14beta1 on Windows 10

Any ideas?
Thomas



В списке pgsql-general по дате отправления:

Предыдущее
От: Nikolay Samokhvalov
Дата:
Сообщение: Re: Framework for 0 downtime deploys
Следующее
От: Tom Lane
Дата:
Сообщение: Re: PG 14 - can't upgrade from a database using an aggregate with anyelement and anyarray