The following bug has been logged on the website:
Bug reference: 9555
Logged by: Fazal Majid
Email address: majid@apsalar.com
PostgreSQL version: 9.2.6
Operating system: OpenIndiana b151 Solaris x64
Description:
Reproduction case:
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:
CREATE TABLE a (
a integer,
b integer,
c integer
)
INHERITS (b);
and after pg_restore, the order of columns is inverted, as if the table
were:
CREATE TABLE a (
a integer,
c integer,
b intege,
)
This causes things like unqualified INSERT INTO statements to start failing
(bad practice, I know).
The solution would be to generate CREATE TABLE followed by ALTER TABLE
INHERIT rather than CREATE TABLE ... INHERITS.