Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WO5ph-0007wk-7C for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2014 13:38:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WO5pg-0004p9-Nx for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Mar 2014 13:38:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WNxQB-0002WC-7F for pgsql-bugs@postgresql.org; Thu, 13 Mar 2014 04:39:07 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WNxQ7-0000Jh-L3 for pgsql-bugs@postgresql.org; Thu, 13 Mar 2014 04:39:06 +0000 MIME-Version: 1.0 Subject: BUG #9555: pg_dump for tables with inheritance recreates the table with the wrong order of columns To: pgsql-bugs@postgresql.org From: majid@apsalar.com Date: Thu, 13 Mar 2014 04:39:00 +0000 Message-ID: <20140313043900.398.17129@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 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. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs