Re: 1 foreign key to 2 different tables?

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: 1 foreign key to 2 different tables?
Дата
Msg-id 20040502141648.GA5848@wolff.to
обсуждение исходный текст
Ответ на Re: 1 foreign key to 2 different tables?  ("Ryan Riehle" <rkr@buildways.com>)
Список pgsql-general
On Sun, May 02, 2004 at 03:51:44 -0400,
  Ryan Riehle <rkr@buildways.com> wrote:
> Thanks for your input. Yes, there is a lot more to this part of the schema.
> The current stucture makes the most sense to us so far, after lots of
> thinking.  If you are interested I can offer you more details about the
> structure, but for now I am looking for how to implement this type of
> constraint with a trigger or another method - if there is a better way.

So far I haven't seen a good case for why there needs to only be one
pointer instead of two. When you are doing joins you are going to know
which one you want to join on. They are internal keys so you shouldn't
need to print them out directly. If you want to display something that
comes out of one joined table or the other, you are going to have to
join both a and b to c using some sort of outer joins. You can use
coalesce to get the information form the appropiate joined table.
You will still have to do things like this even if you share the pointer
field c, but it will be easier to set up the constraints if there are
two separate fields.

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

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