From: Heikki Linnakangas <hlinnaka@iki.fi>
To: Pg Bugs <pgsql-bugs@postgresql.org>
Subject: Multi-parent inherited table with mixed storage options cannot be restored
Date: Thu, 14 May 2020 13:31:11 +0300
Message-ID: <d6be600a-9590-24f6-e144-7f363aece0ab@iki.fi> (raw)
CREATE TABLE parent1 (
col text
);
CREATE TABLE parent2 (
col text
);
CREATE TABLE child () INHERITS (parent1, parent2);
ALTER TABLE ONLY parent1 ALTER COLUMN col SET STORAGE EXTERNAL;
ALTER TABLE ONLY parent2 ALTER COLUMN col SET STORAGE MAIN;
pg_dump dumps those commands in different order (dump attached), with
the SET STORAGE commands before creating the child table. But that's not
allowed:
psql:mixed-storage-inheritance.sql:53: ERROR: inherited column "col"
has a storage parameter conflict
DETAIL: EXTERNAL versus MAIN
That's not good.
What's the best way to fix it? Perhaps pg_dump should leave out the
INHERITS clause from the CREATE TABLE statement, and dump separate
"ALTER TABLE child INHERIT" commands to make it inherited? But then
'attislocal' is wrongly to false for the columns. Or perhaps relax the
check for mixed storage options, so that the CREATE TABLE won't throw
that error.
- Heikki
Attachments:
mixed-storage-inheritance.sql (application/sql, 1.5K) download
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: hlinnaka@iki.fi
Subject: Re: Multi-parent inherited table with mixed storage options cannot be restored
In-Reply-To: <d6be600a-9590-24f6-e144-7f363aece0ab@iki.fi>
References: <d6be600a-9590-24f6-e144-7f363aece0ab@iki.fi>
* 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