Re: NOTICE: ignoring incomplete trigger group for constraint
| От | Raymond O'Donnell | 
|---|---|
| Тема | Re: NOTICE: ignoring incomplete trigger group for constraint | 
| Дата | |
| Msg-id | 4BF803A3.4020909@iol.ie обсуждение исходный текст  | 
		
| Ответ на | Re: NOTICE: ignoring incomplete trigger group for constraint (erobles <erobles@sensacd.com.mx>) | 
| Список | pgsql-general | 
On 22/05/2010 17:03, erobles wrote: > ERROR: there is no unique constraint matching given keys for referenced > table "table_name'" > > > there is a way to solve this?? what can i do ?? It means you need to have a primary key, or at least a unique constraint, on the target table which uses the column(s) which the foreign key references. For example: postgres=# create table a(f1 integer, f2 integer); CREATE TABLE postgres=# create table b(f3 integer, f4 integer); CREATE TABLE postgres=# alter table a add foreign key (f2) references b(f3); ERROR: there is no unique constraint matching given keys for referenced table "b" If I now add a primary key to table b, it works: postgres=# alter table b add primary key(f3); NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "b_pkey" for table "b" ALTER TABLE postgres=# alter table a add foreign key (f2) references b(f3); ALTER TABLE HTH. Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
В списке pgsql-general по дате отправления: