Re: Inheritance and column references problem - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Inheritance and column references problem
Date
Msg-id 20040224162831.X8710@megazone.bigpanda.com
Whole thread Raw
In response to Inheritance and column references problem  (Scott Goodwin <scott@scottg.net>)
Responses Re: Inheritance and column references problem  (Scott Goodwin <scott@scottg.net>)
List pgsql-general
> Is this a bug, or a feature? It seems I can't make a column reference
> work directly with the table that gets inherited by the others. Neither
> can I make a column reference work with a table that *inherits* the
> toinherit table. If I can't get this to work, I'll have to revert back
> to not using inheritance at all.

All of primary key, unique and foreign key constraints don't currently
meaningfully inherit. For the foreign key case the reference goes only
to the directly named table so rows in the subtables are not considered
for purposes of validating the constraint.  In addition, in a structure
where you have a primary key inherited, the child tables do not get the
constraint for uniqueness although that can be added by explicitly putting
the constraint on, however that won't prevent duplicates between the child
and parent nor between children. There are some marginally complicated
workarounds using a separate table that have been discussed on the lists
before and should be available in the archives.

I think I should build a macro for the above. ;)

pgsql-general by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: DBD::Pg 1.32 ready for testing
Next
From: Joe Conway
Date:
Subject: Re: select statement against pg_stats returns inconsistent