Re: Compound keys and foreign constraints - Mailing list pgsql-general

From Manfred Koizar
Subject Re: Compound keys and foreign constraints
Date
Msg-id 3n4p60l7rshbglgfa3rvkltqml5p74d9n3@email.aon.at
Whole thread Raw
In response to Compound keys and foreign constraints  (<wespvp@syntegra.com>)
Responses Re: Compound keys and foreign constraints
List pgsql-general
On Thu, 01 Apr 2004 10:53:40 -0600, <wespvp@syntegra.com> wrote:
>db=> explain select

EXPLAIN ANALYSE please ...

>ERROR:  there is no unique constraint matching given keys for referenced
>table "messages"

>It should be able to use the new compound index, as message_key is the top
>index key.

Don't confuse the *concept* of unique constraints with the
*implementation detail* of unique btree indices.  Per SQL standard you
need a unique constraint on the target column to make sure that only one
row matches any referencing value.

The target column being a part of a non-unique index (or even a unique
index) is not sufficient.

Servus
 Manfred

pgsql-general by date:

Previous
From: "Marc Durham"
Date:
Subject: Re: row-level security model
Next
From:
Date:
Subject: Re: Compound keys and foreign constraints