Re: 1 foreign key to 2 different tables?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: 1 foreign key to 2 different tables?
Дата
Msg-id 20040502013955.GA29213@wolff.to
обсуждение исходный текст
Ответ на Re: 1 foreign key to 2 different tables?  ("Ryan Riehle" <rkr@buildways.com>)
Ответы Re: 1 foreign key to 2 different tables?  ("Ryan Riehle" <rkr@buildways.com>)
Список pgsql-general
On Sat, May 01, 2004 at 18:09:34 -0400,
  Ryan Riehle <rkr@buildways.com> wrote:
> For what I am reading now it looks like this is an opportunity to use CREATE
> ASSERTION, but this functionality appears to be unstable so far and is not
> recommended for production environments.  Is this correct?   Otherwise, can
> someone post an example of implementing a check constraint or trigger since
> I have not created a check onstraint that is above common complexity and and
> have never tried a trigger.

The simplest way to do this is probably be to use two separate fields
to make the references and make sure exactly one of them is nonnull.
You also might want to rethink your design. That you want to do this
suggests that there is something odd about the schema design you
have come up with.

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ryan Riehle"
Дата:
Сообщение: Re: 1 foreign key to 2 different tables?
Следующее
От: Tom Lane
Дата:
Сообщение: Anyone interested in a Pittsburgh-area Postgres users' group?