Quantcast
Channel: Question and Answer » postgresql
Viewing all articles
Browse latest Browse all 1138

postgreSQL FK on delete set null not working

$
0
0

I want to set FK constraint on delete to null but it is not working.

In table transactionauditlogentry I have altered the FK constraints for Packet and Credit table to on delete set null.

If I delete a record from Packet table its working no issues. But if I delete a record from Credit table PSQL gave me error.

insert or update on table "girvi_transactionauditlogentry" violates foreign key constraint "girvi_transactionauditlog_credit_id_78a70d2a_fk_girvi_credit_id"
DETAIL: Key (credit_id)=(1) is not present in table "girvi_credit".

What is wrong??? why its not working??


Parent table: packet, credit
Child table: transactionauditlogentry

Packet table
enter image description here

Credit table
enter image description here

transactionauditlogentry table
enter image description here


Viewing all articles
Browse latest Browse all 1138

Trending Articles