Re: FK v.s unique indexes

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: FK v.s unique indexes
Дата
Msg-id CAKFQuwZLmmG5p-DDBPu6oeLe2UkbRNps4HKPv3Bc8Moo-Gh16w@mail.gmail.com
обсуждение исходный текст
Ответ на FK v.s unique indexes  (Rafal Pietrak <rafal@ztk-rp.eu>)
Ответы Re: FK v.s unique indexes
Список pgsql-general
On Tuesday, July 3, 2018, Rafal Pietrak <rafal@ztk-rp.eu> wrote:

ERROR:  there is no unique constraint matching given keys for referenced
table "test2"
----------------------------

I cannot see any reasons why this functionality is blocked.

In particular, contrary to what the ERROR says, the target table *does
have* a "unique constraint matching given keys", admittedly only
partial.

You are making the common error of confusing the distinct concepts of constraints and indexs.  Table constraints cannot be partial by definition, and are a logical concept constraining the data model.  Indexes are physical objects that only aid in the execution of queries.  The only crossover is that the implementation of a unique table constraint uses a full unique index as an implementation detail.

The error says 'constraint' and indeed you have nit defined a relevant constraint in your schema, just indexes.

David J.

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

Предыдущее
От: Tim Cross
Дата:
Сообщение: Re: FK v.s unique indexes
Следующее
От: Igor Korot
Дата:
Сообщение: Re: How to watch for schema changes