From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow child table to be missing nullable column from parent. |
Date: | 2013-08-22 17:47:49 |
Message-ID: | 17793.1377193669@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jeff Janes <jeff(dot)janes(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2013-08-22 17:56:20 | Re: PL/pgSQL, RAISE and error context |
Previous Message | Jeff Janes | 2013-08-22 17:32:29 | Allow child table to be missing nullable column from parent. |