Re: Re: Changing the default value of an inherited column - Mailing list pgsql-hackers

From Philip Warner
Subject Re: Re: Changing the default value of an inherited column
Date
Msg-id 3.0.5.32.20010403160131.02916100@mail.rhyme.com.au
Whole thread Raw
In response to Re: Re: Changing the default value of an inherited column  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Re: Changing the default value of an inherited column  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 23:57 2/04/01 -0400, Tom Lane wrote:
>
>NOT NULL on a child field would only force it to be dumped if none
>of the parents say NOT NULL.  Type name really is not an issue since
>it will have to be the same in all the tables anyway; I wouldn't bother
>expending any code there.
>

I've made tha changes and it all seems to work, bu there is a minor
inconsistency:
   create table p3_def1(f1 int default 1, f2 int);   create table c5(f1 int not null, f3 int) inherits(p3_def1);

c5 gets dumped as:
   CREATE TABLE "c5" (       "f1" integer DEFAULT 1 NOT NULL,       "f3" integer   )   inherits ("p3_def1");

since the NOT NULL forces the field to dump, and it is dumps as though it
were a real field. 

Similarly,
   create table p2_nn(f1 int not null, f2 int not null);   create table c6(f1 int default 2, ,f3 int) inherits(p2_nn);

results in C6 being dumped as:
   CREATE TABLE "c6" (       "f1" integer DEFAULT 2 NOT NULL,       "f3" integer   )   inherits ("p2_nn");

I think it needs to dump ONLY the overridden settigns, since a change to
the overriding behaviour of a child seems like a bad thing.

What do you think?


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Adriaan Joubert
Date:
Subject: Re: Bug in user-defined types?
Next
From: Philip Warner
Date:
Subject: Re: Re: Changing the default value of an inherited column