pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Claudio Freire <klaussfreire@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: pg_upgrade and materialized views
Date: Tue, 20 Feb 2018 14:02:57 -0800
Message-ID: <20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de> (raw)
In-Reply-To: <20180220215420.cdmx6bfqtzasjjcs@alap3.anarazel.de>
References: <CAGTBQpbrY9CdRGGhyBZ9yqY4jWaGC85rUF4X+R7d-aim=mBNsw@mail.gmail.com>
	<20180220215420.cdmx6bfqtzasjjcs@alap3.anarazel.de>

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




view thread (31+ messages)  latest in thread

Message-ID: <20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de>
Permalink:  ../20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, klaussfreire@gmail.com
  Subject: Re: pg_upgrade and materialized views
  In-Reply-To: <20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de>
  References: <CAGTBQpbrY9CdRGGhyBZ9yqY4jWaGC85rUF4X+R7d-aim=mBNsw@mail.gmail.com> <20180220215420.cdmx6bfqtzasjjcs@alap3.anarazel.de> <20180220220257.hzdm2ar6alt3tjo2@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox