Foreign Key with an "OR" condition (and two concatenated columns)?

Поиск
Список
Период
Сортировка
От Phoenix Kiula
Тема Foreign Key with an "OR" condition (and two concatenated columns)?
Дата
Msg-id CAFWfU=unSzH+WkPtxNjCKH3ZcHQsYER3py1WEGnMNtfNSDA4TA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Foreign Key with an "OR" condition (and two concatenated columns)?  (David Johnston <polobo@yahoo.com>)
Список pgsql-general
Hi. Hope I'm articulating the question correctly.

I currently have a foreign key like this:

    "fk_table2" FOREIGN KEY (id) REFERENCES table1(id) ON DELETE CASCADE;

Given the peculiar needs of this db, it seems that in some cases we
will need to track the "id" of table2 against a concatenation of two
columns in table2. So in pseudocode, it would look something like
this.

    "fk_table2" FOREIGN KEY (id) REFERENCES table1(id   OR
id||'.'||column2) ON DELETE CASCADE;

Do I need a separate constraint for this?

Many thanks for any pointers!

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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: JOIN column maximum
Следующее
От: David Johnston
Дата:
Сообщение: Re: Foreign Key with an "OR" condition (and two concatenated columns)?