Re: [BUG] pg_upgrade test fails from older versions. - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [BUG] pg_upgrade test fails from older versions.
Date
Msg-id Y5/WJgHhbAlwM3Ly@paquier.xyz
Whole thread Raw
In response to [BUG] pg_upgrade test fails from older versions.  ("Anton A. Melnikov" <aamelnikov@inbox.ru>)
List 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

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUG] pg_upgrade test fails from older versions.
Next
From: Michael Paquier
Date:
Subject: Re: [BUG] pg_upgrade test fails from older versions.