Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
Date
Msg-id 14563.1394718457@sss.pgh.pa.us
Whole thread Raw
In response to BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns  (majid@apsalar.com)
List pgsql-bugs
majid@apsalar.com writes:
> create table A(a int, b int, c int);
> create table B(a int, c int);
> alter table A inherit B;

> pg_dump (whether in default or -Fc mode) generates [ A with a,c,b ]

This is not a bug, but expected and desired behavior.  The parent's column
order is considered canonical, and child tables are made to append their
columns to that.  Perhaps in your use-case that's not how you'd like to
think about it, but if we were to change this we'd doubtless break things
for other people.

Possibly you could use pg_upgrade, which I believe does preserve physical
column order in such cases.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: BUG #9557: Row not visible after receiving notification
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns