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

From majid@apsalar.com
Subject BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
Date
Msg-id 20140313043900.398.17129@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
List pgsql-bugs
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.

pgsql-bugs by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: BUG #9557: Row not visible after receiving notification
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #9557: Row not visible after receiving notification