Re: [GENERAL] number of referencing and referenced columns for foreign key disagree
В списке pgsql-general по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [GENERAL] number of referencing and referenced columns for foreign key disagree |
| Дата | |
| Msg-id | 24581.1501335701@sss.pgh.pa.us обсуждение |
| Ответ на | [GENERAL] number of referencing and referenced columns for foreign key disagree (Alexander Farber <alexander.farber@gmail.com>) |
| Ответы |
Re: [GENERAL] number of referencing and referenced columns forforeign key disagree
|
| Список | pgsql-general |
Alexander Farber <alexander.farber@gmail.com> writes:
> Unfortunately, I get the error:
> ERROR: 42830: number of referencing and referenced columns for foreign key
> disagree
> How to refer to the (sid, social) FKs properly please?
You have to use the separate-constraint FK syntax:
CREATE TABLE words_payments (
sid text NOT NULL,
social integer NOT NULL ... ,
foreign key (sid, social) references words_social
);
Or in even more pedantic detail:
foreign key (sid, social) references words_social (sid, social)
You'd have to use that if (sid, social) were not the PK of words_social
but just some random unique key.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера