Re: Creating a table: UNIQUE constraint matching given keys

Поиск
Список
Период
Сортировка
Искать
От
Jason Hihn
Тема
Re: Creating a table: UNIQUE constraint matching given keys
Дата
Msg-id
NGBBLHANMLKMHPDGJGAPMEEECMAA.jhihn@paytimepayroll.com
Ответ на
Список
Дерево обсуждения
Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found Jason Hihn <jhihn@paytimepayroll.com>
Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found Tom Lane <tgl@sss.pgh.pa.us>
Re: Creating a table: UNIQUE constraint matching given keys Jason Hihn <jhihn@paytimepayroll.com>
Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found Bruno Wolff III <bruno@wolff.to>
*smacks palm against forehead in a I-feel-like-a-dolt manner* 
Thank you Bruno and Tom!

> -----Original Message-----
> From: pgsql-novice-owner@postgresql.org
> [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Tom Lane
> Sent: Thursday, August 07, 2003 10:42 AM
> To: Jason Hihn
> Cc: pgsql-novice@postgresql.org
> Subject: Re: [NOVICE] Creating a table: UNIQUE constraint matching given
> keys for referenced table "xy" not found 
> 
> 
> Jason Hihn  writes:
> > 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));
> > ERROR:  UNIQUE constraint matching given keys for referenced 
> table "xy" not
> > found
> 
> I think what you want is a two-column foreign key reference:
> 
> create table xyz( x integer not null, y integer not null, z 
> integer not null,
> primary key (x,y,z),
> foreign key (x,y) references xy(x,y));
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
> 
В списке pgsql-novice по дате отправления
От: Tom Lane
Дата:
От: Josh Berkus
Дата:
Сообщение: Re: database design
FAQ