I have three tables: organization
, organization_teams
and org_users
. Here organization_teams
is inherited from organization
. So suppose if a record is added in organizations_teams
it will get the organization
table id
as value for id
column in organization_teams
.
org_users
has foreign key on id
column of organization
. Now when I try to insert data in org_users
it giving me error as below
insert or update on table "org_users" violates foreign key constraint "org_users_organizations"
DETAIL: Key (org_id)=(12) is not present in table "organizations"
Why?