I got a foreign-key constraint failure with incomplete error message returned from NDB -
1452, u'Cannot add or update a child row: a foreign key constraint fails (Unknown error code)'
I got 2 tables linked with foreinkey constraint. While inserting into child table with no matching row in parent table, I hit the foreign-key constraint failure with incomplete error message as "Unknown error code".
For the same issue using "InnoDB" engine, i got the proper error message as -
1452, u'Cannot add or update a child row: a foreign key constraint fails (`gnocchi`.`metric`, CONSTRAINT `fk_metric_resource_id_resource_id` FOREIGN KEY (`resource_id`) REFERENCES `resource` (`id`) ON DELETE SET NULL)'
Here is the complete version of MySQLCluster i am using -
mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
+-------------------------+--------------------------------------+
| Variable_name | Value |
+-------------------------+--------------------------------------+
| innodb_version | 5.7.17 |
| ndb_version | 460037 |
| ndb_version_string | ndb-7.5.5 |
| ndbinfo_version | 460037 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1 |
| version | 5.7.17-ndb-7.5.5-cluster-gpl |
| version_comment | MySQL Cluster Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+--------------------------------------+
1452, u'Cannot add or update a child row: a foreign key constraint fails (Unknown error code)'
I got 2 tables linked with foreinkey constraint. While inserting into child table with no matching row in parent table, I hit the foreign-key constraint failure with incomplete error message as "Unknown error code".
For the same issue using "InnoDB" engine, i got the proper error message as -
1452, u'Cannot add or update a child row: a foreign key constraint fails (`gnocchi`.`metric`, CONSTRAINT `fk_metric_resource_id_resource_id` FOREIGN KEY (`resource_id`) REFERENCES `resource` (`id`) ON DELETE SET NULL)'
Here is the complete version of MySQLCluster i am using -
mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
+-------------------------+--------------------------------------+
| Variable_name | Value |
+-------------------------+--------------------------------------+
| innodb_version | 5.7.17 |
| ndb_version | 460037 |
| ndb_version_string | ndb-7.5.5 |
| ndbinfo_version | 460037 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1 |
| version | 5.7.17-ndb-7.5.5-cluster-gpl |
| version_comment | MySQL Cluster Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+--------------------------------------+