So, I was using mysql server on Centos 6 and it was alright then, I shifted my code to Centos 7 server.
I had a constraint in an table where I used to insert null values by default in MySQL Server. I guess thats not happenning in MariaDB.
I get the following error when inserting data.
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (dbName
.tableName
, CONSTRAINT constraintName
FOREIGN KEY (columnName
) REFERENCES externalTableName
(externalTableColumnName
))
Any help would be appreciated.
Thanks
UPDATE 1 :
Table with the key to be referenced :
CREATE TABLE `users` (
`uid` int(25) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`uid`)
);
CREATE TABLE `abc_xyz` (
`isUser` int(25) DEFAULT NULL,
`last_modified_user` int(25) DEFAULT NULL,
KEY `abc_xyz_is_user` (`isUser`),
KEY `abc_xyz_last_modified_user` (`last_modified_user`),
CONSTRAINT `abc_xyz_is_user` FOREIGN KEY (`isUser`) REFERENCES `users` (`uid`),
CONSTRAINT `abc_xyz_last_modified_user`
FOREIGN KEY (`last_modified_user`) REFERENCES `users` (`uid`)
);