Re: Problem between inheritance and references - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Problem between inheritance and references
Date
Msg-id 20020723085643.X25093-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Re: Problem between inheritance and references  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Responses Re: Problem between inheritance and references
List pgsql-general
On Tue, 23 Jul 2002, Stephane Bortzmeyer wrote:

> On Tue, Jul 23, 2002 at 08:11:30AM -0700,
>  Stephan Szabo <sszabo@megazone23.bigpanda.com> wrote
>  a message of 16 lines which said:
>
> > The problem is that foreign keys, primary keys, unique constraints,
> > and triggers (and maybe other stuff, but at least that) don't
> > inherit,
>
> :-( So basically, INHERITS just give you the columns of the parent
> table?

Well, you get check constraints as well AFAIR. Doing the rest of the
above is something that will probably get done eventually, but it
could definately use some work by the people that are using it on
a regular basis.

> > so the foreign key is referencing only the table mentioned.  The
> > equivalent select is select * from ONLY Authentication I believe.
>
> OK, I see the problem. Any suggestion on how to rephrase my schema
> (besides dropping inheritance)?

Umm, in general the only way I've heard of was doing a separate table
that stores the official value of the keys that has the inheritance
tree referencing it (each table therein) and outside references go
to that table as well.  That also guarantees uniqueness which isn't
guaranteed if you have separate unique constraints on each table.


pgsql-general by date:

Previous
From: Stephane Bortzmeyer
Date:
Subject: Re: Problem between inheritance and references
Next
From: Robert Treat
Date:
Subject: Re: No command history in psql