Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WO5z8-0008Pu-Dc for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2014 13:47:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WO5z7-0001gN-Qp for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2014 13:47:45 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WO5z7-0001gH-5q for pgsql-bugs@postgresql.org; Thu, 13 Mar 2014 13:47:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WO5z0-00015a-TZ for pgsql-bugs@postgresql.org; Thu, 13 Mar 2014 13:47:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s2DDlbBk014564; Thu, 13 Mar 2014 09:47:37 -0400 From: Tom Lane To: majid@apsalar.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns In-reply-to: <20140313043900.398.17129@wrigleys.postgresql.org> References: <20140313043900.398.17129@wrigleys.postgresql.org> Comments: In-reply-to majid@apsalar.com message dated "Thu, 13 Mar 2014 04:39:00 -0000" Date: Thu, 13 Mar 2014 09:47:37 -0400 Message-ID: <14563.1394718457@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs