Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found
Date
Msg-id 20030807142724.GA5549@wolff.to
Whole thread Raw
In response to Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found  (Jason Hihn <jhihn@paytimepayroll.com>)
List pgsql-novice
On Thu, Aug 07, 2003 at 10:11:54 -0400,
  Jason Hihn <jhihn@paytimepayroll.com> wrote:
>
> Appendix:
> create table xy( x integer not null, y integer not null, primary key (x,y));
> create table xyz( x integer not null references xy(x), y integer not null
> references xy(y), z integer not null, primary key (x,y,z));
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'xyz_pkey'
> for table 'xyz'
> NOTICE:  CREATE TABLE will create implicit trigger(s) for FOREIGN KEY
> check(s)
> ERROR:  UNIQUE constraint matching given keys for referenced table "xy" not
> found

You either need to create a unique index for x and for y for table xy
or you need to use the foreign key clause to use (x,y) as a reference
to table xy.

pgsql-novice by date:

Previous
From: Jason Hihn
Date:
Subject: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found
Next
From: Tom Lane
Date:
Subject: Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found