BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns

From: majid(at)apsalar(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
Date: 2014-03-13 04:39:00
Message-ID: 20140313043900.398.17129@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 9555
Logged by: Fazal Majid
Email address: majid(at)apsalar(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2014-03-13 05:34:26 Re: BUG #9552: IndexOnlyScan startup_cost>0, why not equal 0?it's a bug?
Previous Message David Johnston 2014-03-13 04:16:00 Re: BUG #9554: won't connect

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2014-03-13 04:45:16 Re: Patch: show relation and tuple infos of a lock to acquire
Previous Message Greg Stark 2014-03-13 03:51:42 Re: 9a57858f1103b89a5674f0d50c5fe1f756411df6