Re: Allow child table to be missing nullable column from parent. - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Allow child table to be missing nullable column from parent.
Date
Msg-id 17793.1377193669@sss.pgh.pa.us
Whole thread Raw
In response to Allow child table to be missing nullable column from parent.  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
Jeff Janes <jeff.janes@gmail.com> writes:
> Currently a child table has to have all the columns the parent table has:
> create table foo1 (x integer, y text, z bool);
> create table foo2 (x integer, y text, q text);
> alter table foo2 inherit foo1 ;
> ERROR:  child table is missing column "z"

> In theory it seems like this could be allowed as long as the parent
> column is nullable, then the column is just deemed to be all null in
> the child.

TBH this doesn't seem like a very good idea.  It suggests strongly that
you messed up the inheritance, and even if it was intentional, what
did you save by not having the child column?

To point out just one practical problem, what is supposed to happen when
you do "UPDATE foo1 SET z = true WHERE ..." with a condition that selects
some rows in foo2?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Jeff Janes
Date:
Subject: Allow child table to be missing nullable column from parent.
Next
From: Pavel Stehule
Date:
Subject: Re: PL/pgSQL, RAISE and error context