Re: FK v.s unique indexes - Mailing list pgsql-general

From Tim Cross
Subject Re: FK v.s unique indexes
Date
Msg-id 87va9wvugn.fsf@gmail.com
Whole thread Raw
In response to FK v.s unique indexes  (Rafal Pietrak <rafal@ztk-rp.eu>)
List pgsql-general
Rafal Pietrak <rafal@ztk-rp.eu> writes:

>
> In particular, contrary to what the ERROR says, the target table *does
> have* a "unique constraint matching given keys", admittedly only
> partial. Yet, why should that matter at all? A unique index, partial or
> not, always yield a single row, and that's all what matters for FK. Right?
>
Is that correct? I would have thought that if you have a multi-key
unique index and you only provide values for some of the keys in the
index, you would have no guarantee of a single row being returned. If
this was true, then the additional keys are superfluous.

Have you tried doing the same thing where the fk keys and remote unique
index keys are equal in number?

-- 
Tim Cross


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: When exactly is a TIMESTAMPTZ converted to the sessions time zone?
Next
From: "David G. Johnston"
Date:
Subject: Re: FK v.s unique indexes