|< < 26 > >|

Foreign keys and updates

Deleting the P row with p_id = 4 succeeds:
jao=# delete from p where p_id = 4; DELETE 1

But deleting the P row with p_id = 1 fails:
jao=# delete from p where p_id = 1; ERROR: update or delete on table "p" violates foreign key constraint "f_p_id_fkey" on table "f" DETAIL: Key (p_id)=(1) is still referenced from table "f".

Updating that row's p_id also fails:
jao=# update P set p_id = 99 where p_id = 1; ERROR: update or delete on table "p" violates foreign key constraint "f_p_id_fkey" on table "f" DETAIL: Key (p_id)=(1) is still referenced from table "f".

|< < 26 > >|