Re: Problem between inheritance and references

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Problem between inheritance and references
Дата
Msg-id 20020723085643.X25093-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Re: Problem between inheritance and references  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Ответы Re: Problem between inheritance and references  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
Список 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 по дате отправления:

Предыдущее
От: Stephane Bortzmeyer
Дата:
Сообщение: Re: Problem between inheritance and references
Следующее
От: Robert Treat
Дата:
Сообщение: Re: No command history in psql