Below is the scenario
Table1
(Id, Name
)Table2
(Id, Name1, Name2, Type
)FK1
:Name1
referencesTable1.Name
withOn delete cascade
FK2
:Name2
referencesTable1.Name
withOn delete cascade
FK2
throws the below error
ERROR:
Introducing FOREIGN KEY constraint FK2 on table Table2 may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
But, in my scenario whether the entity with Name1
or Name2
is deleted the corresponding entry in Table2
should be deleted.
Please help me understand what is the problem this could cause?