Re: pg_upgrade and materialized views

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pg_upgrade and materialized views
Дата
Msg-id 20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pg_upgrade and materialized views  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
Hi,

On 2018-02-20 13:54:20 -0800, Andres Freund wrote:
> note that the above if clause doesn't include materialized tables. Which
> sems to explain this bug?  Could you check that just updating the above
> if to include matviews fixes the bug for you?

I suspect that a proper fix would be to move the relevant block one
level up, to have it's own if block. The current location seems to be
wrong, this is unrelated work to the header:
         * To create binary-compatible heap files, we have to ensure the same
         * physical column order, including dropped columns, as in the
         * original.  Therefore, we create dropped columns above and drop them
         * here, also updating their attlen/attalign values so that the
         * dropped column can be skipped properly.  (We do not bother with
         * restoring the original attbyval setting.)  Also, inheritance
         * relationships are set up by doing ALTER TABLE INHERIT rather than
         * using an INHERITS clause --- the latter would possibly mess up the
         * column order.  That also means we have to take care about setting
         * attislocal correctly, plus fix up any inherited CHECK constraints.
         * Analogously, we set up typed tables using ALTER TABLE / OF here.
         */
of that block.

A later if block just concerned to restoring frozenxid for all relevant
types of tables seems more appropriate. I also wonder if we shouldn't
just always restore relfrozenxid / minmxid if set on the source system,
rather than having relkind specific dispatch.

Also, dear god, this code could use some refactoring :(

Greetings,

Andres Freund


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: pg_upgrade and materialized views
Следующее
От: Claudio Freire
Дата:
Сообщение: Re: pg_upgrade and materialized views