Re: multiple UNIQUE indices for FK
От | David G. Johnston |
---|---|
Тема | Re: multiple UNIQUE indices for FK |
Дата | |
Msg-id | CAKFQuwZ1rDPjEv2tAs9QRigUpea8J16AacXmNbxtQJR319SqEg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: multiple UNIQUE indices for FK (Rafal Pietrak <rafal@ztk-rp.eu>) |
Ответы |
Re: multiple UNIQUE indices for FK
Re: multiple UNIQUE indices for FK |
Список | pgsql-general |
W dniu 23.02.2016 o 09:39, Rafal Pietrak pisze:> Can anybody suggest any other way out of this mass?
The only thought that sticks while reading your prose is:
message ----> message-person <---- person
message-person (message_id, person_id, relationship_type[sender, receiver])
Partitioning and partial indexes both have considerable limitations that you might need to work around. That said normalization exists for a reason and having multiple "person" columns in a table is a form of duplication that if left presents just the problems you are seeing.
I suspect your SSN should fit onto the message-person table.
The following doesn't make sense - if the SSN is sender unique then there is no expectation that a receiver would not receive two messages with the same SSN from different senders.
ALTER ... msgs_to_me ADD CONSTRINT them_uniq UNIQUE (THEM,SSN);
David J.
В списке pgsql-general по дате отправления: