On Fri, Jul 30, 2010 at 10:22, Robert Haas <robertmhaas@gmail.com> wrote:
> OK, it looks like level_2_parent is actually irrelevant to this issue.
> So here's a slightly simplified test case:
>
> DROP SCHEMA IF EXISTS test_inheritance CASCADE;
> CREATE SCHEMA test_inheritance;
> SET search_path TO test_inheritance;
>
> CREATE TABLE top (i int);
> CREATE TABLE mid1 () INHERITS (top);
> CREATE TABLE mid2 () INHERITS (top);
> CREATE TABLE bottom () INHERITS (mid1, mid2);
> CREATE TABLE basement () INHERITS (bottom);
>
> ALTER TABLE top ADD CONSTRAINT a_check_constraint CHECK (i = 0);
The other problem with the current code is it creates a dump that is
not consistent with \d. The dump gets it "right" in the sense that
basement does not have the constraint. We could debate what
coninhcount should be, but clearly there is a bug here. [ FYI with
your patch the dump is, of course, consistent again (no
a_check_constraint) ]