Re: Problem between inheritance and references

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Stephane Bortzmeyer <bortzmeyer(at)nic(dot)fr>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Problem between inheritance and references
Date: 2002-07-23 16:01:08
Message-ID: 20020723085643.X25093-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 23 Jul 2002, Stephane Bortzmeyer wrote:

> On Tue, Jul 23, 2002 at 08:11:30AM -0700,
> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2002-07-23 16:17:56 Re: No command history in psql
Previous Message Daryl Beattie 2002-07-23 16:00:36 Auto DROP SEQUENCE?