Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id ECEEE1337B8A for ; Tue, 1 Feb 2011 12:08:08 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 30022-07 for ; Tue, 1 Feb 2011 16:08:01 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 16DE01337B69 for ; Tue, 1 Feb 2011 12:08:00 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p11G7qB0027043; Tue, 1 Feb 2011 11:07:52 -0500 (EST) To: depstein@alliedtesting.com cc: pgsql-bugs@postgresql.org, pgagarinov@alliedtesting.com Subject: Re: pg_dump doesn't save altered column information for inherited columns In-reply-to: <29F36C7C98AB09499B1A209D48EAA615B501DA89D3@mail2a.alliedtesting.com> References: <29F36C7C98AB09499B1A209D48EAA615B501DA89D3@mail2a.alliedtesting.com> Comments: In-reply-to message dated "Tue, 01 Feb 2011 12:55:49 +0300" Date: Tue, 01 Feb 2011 11:07:52 -0500 Message-ID: <27042.1296576472@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201102/6 X-Sequence-Number: 29278 writes: > I noticed that when pg_dump saves SQL code for a table with inheritance, it does not save any information about inherited columns. This is fine when inherited columns do not undergo any modification, but when they do, that information is lost. > Example: > create table parent (id integer not null); > create table child (value integer) inherits (parent); > alter table child alter column id drop not null; Actually, the bug here is that ALTER TABLE lets you do that. Dropping an inherited constraint should be disallowed, and is disallowed for the case of CHECK constraints. We haven't gotten around to enhancing the NOT NULL infrastructure to detect that, but it's on the TODO list. In the meantime, there's no point in modifying pg_dump to worry about such cases. regards, tom lane