Reputation: 19589
such as this constraint:
alter table TABLE_NAME
add constraint FK_CONSTRAINT_ID foreign key (COLUMN_NAME)
references PARENT_TABLE_NAME(PARENT_COLUMN_NAME)
on delete set null
on update set null;
will mysql do constraints check immediately (that is, check all rows) after add action
OR just later ON DELETE or ON UPDATE event?
How about other database?
If not immediatelly, how to do a mannually full table row check ?
Upvotes: 0
Views: 47
Reputation: 1271231
A foreign key constraint is a property of a table and one or more columns in the table. It says that these columns refer to primary key (or unique indexed) columns in another table.
Hence, when the constraint is created, the table is checked to be sure that the constraint is valid.
The on delete
and on update
after what happens during those operations. It does not change the fact that the constraint is on the table and must be valid.
Upvotes: 2