Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 439851337F08 for ; Tue, 1 Feb 2011 06:10:23 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 61630-01-8 for ; Tue, 1 Feb 2011 10:10:15 +0000 (UTC) X-Greylist: delayed 00:05:26.709967 by SQLgrey-1.7.6 Received: from mail2a.alliedtesting.com (unknown [80.249.134.186]) by mail.postgresql.org (Postfix) with ESMTP id C20AD1337F26 for ; Tue, 1 Feb 2011 06:01:24 -0400 (AST) Received: from mail2a.alliedtesting.com ([192.168.66.21]) by mail2a.alliedtesting.com ([192.168.66.21]) with mapi; Tue, 1 Feb 2011 12:55:51 +0300 From: To: CC: Date: Tue, 1 Feb 2011 12:55:49 +0300 Subject: pg_dump doesn't save altered column information for inherited columns Thread-Topic: pg_dump doesn't save altered column information for inherited columns Thread-Index: AcvB9KKqfsjdtqRmR3C7BcZhKsUncg== Message-ID: <29F36C7C98AB09499B1A209D48EAA615B501DA89D3@mail2a.alliedtesting.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_29F36C7C98AB09499B1A209D48EAA615B501DA89D3mail2aalliedt_" MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.106 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201102/1 X-Sequence-Number: 29273 --_000_29F36C7C98AB09499B1A209D48EAA615B501DA89D3mail2aalliedt_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello, 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 i= nherited columns do not undergo any modification, but when they do, that in= formation 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; insert into child values (null, 1); Here is the code of the child table as generated by pg_dump: CREATE TABLE child ( value integer ) INHERITS (parent); When the table is recreated using this code, the id column has the NOT NULL= restriction, which was not present in the original. I don't think this is right. Either inherited columns should be immune to c= hanges, or else pg_dump should reflect those changes in its SQL code. Dmitry Dmitry Epstein | Developer Allied Testing T + 7 495 544 48 69 Ext 417 M + 7 926 215 73 36 www.alliedtesting.com We Deliver Quality. --_000_29F36C7C98AB09499B1A209D48EAA615B501DA89D3mail2aalliedt_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hello,

 

I notic= ed that when pg_dump saves SQL code for a table with inheritance, it does n= ot save any information about inherited columns. This is fine when inherite= d columns do not undergo any modification, but when they do, that informati= on 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;

 

insert in= to child values (null, 1);

 

Here is the code of the child table as generat= ed by pg_dump:

 

CREATE TABLE child (=

    valu= e integer

)

INHERITS (pare= nt);

 

When the table is recreated using this code, the id column has the N= OT NULL restriction, which was not present in the original.

<= p class=3DMsoNormal> 

I don’t= think this is right. Either inherited columns should be immune to changes,= or else pg_dump should reflect those changes in its SQL code.

 

Dmitry

 

Dmit= ry Epstein | D= eveloper

=

<= p class=3DMsoNormal style=3D'vertical-align:top'>Allied Testing

T + 7 495 544 48 69 Ex= t 417

M + 7 926 215 73 36

 

www.alliedtesting.com=

We Deliver Quality.

 

= --_000_29F36C7C98AB09499B1A209D48EAA615B501DA89D3mail2aalliedt_--