Re: unique constraints
От | Michael Fuhr |
---|---|
Тема | Re: unique constraints |
Дата | |
Msg-id | 20040107103147.A11576@quality.qadas.com обсуждение исходный текст |
Ответ на | unique constraints (Kenneth Gonsalves <lawgon@thenilgiris.com>) |
Ответы |
Re: unique constraints
|
Список | pgsql-sql |
On Wed, Jan 07, 2004 at 07:47:32PM +0530, Kenneth Gonsalves wrote: > in 7.4 i'm getting an error message - UNIQUE constraint matching keys for > table 'xxx' not found - any clues? It would be helpful to see the *exact* wording of the error message and the SQL statements that can be used to reproduce the error. I'd guess that you tried to create a foreign key constraint whose referenced column(s) didn't have a UNIQUE constraint: => CREATE TABLE foo (foo_id INTEGER NOT NULL); CREATE TABLE => CREATE TABLE bar (foo_id INTEGER NOT NULL REFERENCES foo (foo_id)); ERROR: there is no unique constraint matching given keys for referenced table "foo" The referenced column(s) should either be a PRIMARY KEY or have a UNIQUE constraint: => CREATE TABLE foo (foo_id INTEGER PRIMARY KEY); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo" CREATE TABLE => CREATE TABLE bar (foo_id INTEGER NOT NULL REFERENCES foo (foo_id)); CREATE TABLE See the "Foreign Keys" documentation for more info: http://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-FK -- Michael Fuhr http://www.fuhr.org/~mfuhr/
В списке pgsql-sql по дате отправления: