NOTICE: ignoring incomplete trigger group for constraint

Started by eroblesalmost 16 years ago4 messagesgeneral
Jump to latest
#1erobles
erobles@sensacd.com.mx

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Droid Sans">hi !<br>
<br>
I have running&nbsp; postgres 8.3.1&nbsp; and&nbsp;&nbsp; a dump file&nbsp; from postgers 7.2&nbsp;
:-P ,&nbsp;&nbsp; but when&nbsp; i tried to restore the dump i have&nbsp; the next&nbsp;&nbsp;
message:<br>
(by the way&nbsp; i&nbsp;&nbsp; made&nbsp; the dump file using pg_dump of postgresql 8.3)<br>
<br>
<br>
CREATE CONSTRAINT TRIGGER "valida_ent_a_sal" AFTER DELETE ON "ent_a"&nbsp;&nbsp;
INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE
"RI_FKey_noaction_del" ('valida_ent_a_sal', 'sal_d', 'ent_a', 'FULL',
'tagname_ed', 'tagname_ea');
<br>
<br>
psql:lostriggers:10: NOTICE:&nbsp; ignoring incomplete trigger group for
constraint "valida_ent_a_sal" FOREIGN KEY sal_d(tagname_ed) REFERENCES
ent_a(tagname_ea)
<br>
<br>
DETAIL:&nbsp; Found referenced table's DELETE trigger.
<br>
<br>
CREATE TRIGGER
<br>
<br>
and this:<br>
<br>
<br>
CREATE CONSTRAINT TRIGGER "&lt;unnamed&gt;" AFTER UPDATE ON "scenes"&nbsp;
FROM "scenes_sub"&nbsp; INITIALLY IMMEDIATE FOR EACH ROW EXECUTE PROCEDURE
"RI_FKey_noaction_upd" ('&lt;unnamed&gt;', 'scenes_sub', 'scenes',
'UNSPECIFIED', 'scene', 'scene', 'tag', 'tag');
<br>
<br>
psql:lostriggers:965: NOTICE:&nbsp; ignoring incomplete trigger group for
constraint "&lt;unnamed&gt;" FOREIGN KEY scenes_sub(scene,tag)
REFERENCES scenes(scene,tag)
<br>
<br>
DETAIL:&nbsp; Found referenced table's UPDATE trigger.
<br>
CREATE TRIGGER
<br>
<br>
<br>
why some triggers are unnamed???<br>
<br>
Which&nbsp; is the best&nbsp; way&nbsp; to solve this????&nbsp; searching on google&nbsp;&nbsp;
found&nbsp; that i must&nbsp; create foreign keys, but i don't know if&nbsp; is enough
with the creation of the foreign key&nbsp; or if&nbsp; i must create&nbsp; the foreign
key and the constraint&nbsp; too.<br>
<br>
there is an&nbsp; 'automagic'&nbsp; way to&nbsp; convert&nbsp; a constraint into a foreign
key&nbsp; ;-)<br>
<br>
<br>
thanks!<br>
<br>
</font>
</body>
</html>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: erobles (#1)
Re: NOTICE: ignoring incomplete trigger group for constraint

erobles <erobles@sensacd.com.mx> writes:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

[ Please don't send all-html mail to the lists ]

I have running postgres 8.3.1 and a dump file from postgers 7.2
:-P , but when i tried to restore the dump i have the next
message:

psql:lostriggers:10: NOTICE: ignoring incomplete trigger group for
constraint "valida_ent_a_sal" FOREIGN KEY sal_d(tagname_ed) REFERENCES
ent_a(tagname_ea)

Yeah, this is known to happen in some cases where there was a broken
(incompletely enforced) foreign key constraint in your old database.
The odds are good that what you should do is nothing at all, because
you probably didn't even realize you still had the FK constraint in the
old database: the most common error cases weren't enforced. It's likely
that if you try to add the FK constraint now, you'll find it fails
because the data doesn't even satisfy the constraint. So you could
just leave things alone and the new database will behave approximately
like the old one did. But if you really want to add the FK constraint
back in, ALTER TABLE ADD FOREIGN KEY is the way.

BTW, the known cases for this are follow-on damage from a bug in 7.0
pg_dump. Does the ancestry of this database go back that far?

regards, tom lane

#3erobles
erobles@sensacd.com.mx
In reply to: Tom Lane (#2)
Re: NOTICE: ignoring incomplete trigger group for constraint

On 05/21/2010 11:18 AM, Tom Lane wrote:

Yeah, this is known to happen in some cases where there was a broken
(incompletely enforced) foreign key constraint in your old database.
The odds are good that what you should do is nothing at all, because
you probably didn't even realize you still had the FK constraint in the
old database: the most common error cases weren't enforced. It's likely
that if you try to add the FK constraint now, you'll find it fails
because the data doesn't even satisfy the constraint. So you could
just leave things alone and the new database will behave approximately
like the old one did. But if you really want to add the FK constraint
back in, ALTER TABLE ADD FOREIGN KEY is the way.

hi, i made the alter table to add the foreign key, but in some
constraints i have the follow error:

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 ??

regards, erobles

In reply to: erobles (#3)
Re: NOTICE: ignoring incomplete trigger group for constraint

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