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 обсуждение исходный текст |
Ответ на | Re: Creating a table: UNIQUE constraint matching given keys for referenced table "xy" not found (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-novice |
*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 <jhihn@paytimepayroll.com> 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 по дате отправления: