Re: [BUG] pg_upgrade test fails from older versions.

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "Anton A(dot) Melnikov" <aamelnikov(at)inbox(dot)ru>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [BUG] pg_upgrade test fails from older versions.
Date: 2022-12-19 03:10:30
Message-ID: Y5/WJgHhbAlwM3Ly@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Dec 19, 2022 at 03:50:19AM +0300, Anton A. Melnikov wrote:
> +-- The internal format of "aclitem" changed in PostgreSQL version 16
> +-- so replace it with text type
> +\if :oldpgversion_le15
> +DO $$
> +DECLARE
> + change_aclitem_type TEXT;
> +BEGIN
> + FOR change_aclitem_type IN
> + SELECT 'ALTER TABLE ' || table_schema || '.' ||
> + table_name || ' ALTER COLUMN ' ||
> + column_name || ' SET DATA TYPE text;'
> + AS change_aclitem_type
> + FROM information_schema.columns
> + WHERE data_type = 'aclitem' and table_schema != 'pg_catalog'
> + LOOP
> + EXECUTE change_aclitem_type;
> + END LOOP;
> +END;
> +$$;
> +\endif

This is forgetting about materialized views, which is something that
pg_upgrade would also complain about when checking for relations with
aclitems. As far as I can see, the only place in the main regression
test suite where we have an aclitem attribute is tab_core_types for
HEAD and the stable branches, so it would be enough to do this
change. Anyway, wouldn't it be better to use the same conditions as
the WITH OIDS queries a few lines above, at least for consistency?

Note that check_for_data_types_usage() checks for tables, matviews and
indexes.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-12-19 03:16:18 Re: [BUG] pg_upgrade test fails from older versions.
Previous Message Tom Lane 2022-12-19 01:56:48 Re: [BUG] pg_upgrade test fails from older versions.