From: Tim Cross <theophilusx@gmail.com>
To: Rafal Pietrak <rafal@ztk-rp.eu>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: FK v.s unique indexes
Date: Wed, 04 Jul 2018 08:13:28 +1000
Message-ID: <87va9wvugn.fsf@gmail.com> (raw)
In-Reply-To: <d9f85c60-3cdd-2504-cc6e-83fee0e19384@ztk-rp.eu>
References: <d9f85c60-3cdd-2504-cc6e-83fee0e19384@ztk-rp.eu>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: theophilusx@gmail.com, rafal@ztk-rp.eu
Subject: Re: FK v.s unique indexes
In-Reply-To: <87va9wvugn.fsf@gmail.com>
References: <d9f85c60-3cdd-2504-cc6e-83fee0e19384@ztk-rp.eu> <87va9wvugn.fsf@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox