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

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: majid(at)apsalar(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns
Date: 2014-03-14 15:33:04
Message-ID: 20140314153304.GA6899@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > majid(at)apsalar(dot)com wrote:
> >> Reproduction case:
> >>
> >> create table A(a int, b int, c int);
> >> create table B(a int, c int);
> >> alter table A inherit B;
>
> > I wonder if the real fix here is to have ALTER / INHERIT error out of
> > the columns in B are not a prefix of those in A.
>
> Years ago, we sweated quite a lot of blood to make these cases work.
> I'm not thrilled about throwing away all that effort because one person
> doesn't like the behavior.

Hm, well in that case it makes sense to consider the original
suggestion: if the columns in the parent are not a prefix of those of
the child, use ALTER INHERIT after creating both tables rather than
CREATE TABLE INHERITS.

It'd be a lot of new code in pg_dump though. I am not volunteering ...

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2014-03-14 19:43:14 Re: Re: BUG #9301: INSERT WHERE NOT EXISTS on table with UNIQUE constraint in concurrent SERIALIZABLE transactions
Previous Message Fazal Majid 2014-03-14 14:54:43 Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns

Browse pgsql-hackers by date

  From Date Subject
Next Message Marti Raudsepp 2014-03-14 15:54:26 Re: Disk usage for intermediate results in join
Previous Message Fazal Majid 2014-03-14 14:54:43 Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns