1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[SQL] (1452, 'Cannot add or update a child row: a foreign key constraint fails ). with data...

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 11, 2024.

  1. Stack

    Stack Membro Participativo

    I I have a django service that interacts with a mysql database that I first developed locally, here no problem however once the database is recreated online on an o2switch server, the foreign key constraints no longer work and I can't understand why, I tried to insert a row in the table 'nomchamp' with data existing in the parent table con but this still returns me the error (1452, 'Cannot add or update a child row: a foreign key constraint fails (goqo5870_lddb.nomchamp, CONSTRAINT nomchamp_ibfk_1 FOREIGN KEY (IDCon) REFERENCES con (ID))'). error raise by django

    I tried this command in phpmyadmin : INSERT INTO nomchamp(IDCon, NOM) VALUES (1, 'PROSPECT'); and this raise the same error I dont understand. ID in table con

    So the error is caused by the database not by django but I dont know why this error occurred, I create the database with a sql dump file of my local database.

    Continue reading...

Compartilhe esta Página