Multi-parent inherited table with mixed storage options cannot berestored - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Multi-parent inherited table with mixed storage options cannot berestored
Date
Msg-id d6be600a-9590-24f6-e144-7f363aece0ab@iki.fi
Whole thread Raw
Responses Re: Multi-parent inherited table with mixed storage options cannot be restored  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-bugs
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


Attachment

pgsql-bugs by date:

Previous
From: Konstantin Davydenka
Date:
Subject: Re:BUG #16434: some data lost
Next
From: Pavel Stehule
Date:
Subject: Re: BUG #16436: Functions with input parameter table type failingfrom application