| От | Tom Lane |
|---|---|
| Тема | Re: Foreign Key Unique Constraint can be dropped |
| Дата | |
| Msg-id | 12053.1244469053@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Foreign Key Unique Constraint can be dropped (Vlado Moravec <vm.devs@gmail.com>) |
| Список | pgsql-general |
Vlado Moravec <vm.devs@gmail.com> writes:
> from postgres docs: "foreign key must reference columns that either are a
> primary key or form a unique constraint". It does not allow creating foreign
> key constraint on non-unique column - an error is raised.
> After playing with a new database I discovered that such a unique constraint
> can be droped after the foreign key constraint has been established. No
> warning, no error.
Not in any remotely modern version of Postgres. Maybe you had more than
one unique index, and it chose the other one as the FK's dependency?
There's nothing prohibiting the creation of redundant indexes ...
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера