Re: multiple UNIQUE indices for FK

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rafal Pietrak <rafal(at)ztk-rp(dot)eu>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: multiple UNIQUE indices for FK
Date: 2016-03-01 22:08:10
Message-ID: CAKFQuwZSRiDJcAkNT73oE0z4bqLBPpcYszbAm_vWvZEY16DYCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)ztk-rp(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2016-03-01 22:14:09 Re: commit time in logical decoding
Previous Message Weiping Qu 2016-03-01 21:16:24 Re: commit time in logical decoding