Re: multiple UNIQUE indices for FK

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: multiple UNIQUE indices for FK
Дата
Msg-id CAKFQuwZSRiDJcAkNT73oE0z4bqLBPpcYszbAm_vWvZEY16DYCg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: multiple UNIQUE indices for FK  (Rafal Pietrak <rafal@ztk-rp.eu>)
Список pgsql-general
Sorry for the delay - used to getting replied-to-all on messages I send but you didn't and I didn't notice the response until now.

On Mon, Feb 29, 2016 at 4:03 AM, Rafal Pietrak <rafal@ztk-rp.eu> wrote:
>
> 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.

I don't get it.

Of cource it's possible to receive two messages with the same SSN.

By "sender unique" I mean, that every sender has full control of
whatever he/she wishes to use for SSN, provided that he/she does not
assign duplicates. It also means, that there is no relation between SSN
assigned by different senders and collisions *should* be expected unless
UNIQUE covers both THEM/SENDR and SSN.

Thus:
> ALTER ... msgs_to_me ADD CONSTRINT them_uniq UNIQUE (THEM,SSN);


​Yeah, mental lapse on my part.​

​​David J.

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

Предыдущее
От: Weiping Qu
Дата:
Сообщение: Re: commit time in logical decoding
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: commit time in logical decoding