MySQL Forums
Forum List  »  NDB clusters

Re: ERROR 1005 (HY000): Can't create table
Posted by: Mauritz Sundell
Date: March 05, 2021 03:54AM

When using Ndb it is always a good habit to also do "SHOW WARNINGS" when a sql statement fails.

mysql> CREATE TABLE policy_statements ( id VARCHAR(255) NOT NULL, `policyId` VARCHAR(255), `condition` TEXT, verb VARCHAR(10), `resourceType` VARCHAR(64), `compartmentId`
VARCHAR(255), `compartmentRefType` ENUM('ID','NAME'), `allowAnyGroup` BOOL DEFAULT '0', PRIMARY KEY (id), FOREIGN KEY(`policyId`) REFERENCES policies (id) ON DELETE CASCADE, FOREIGN KEY(`compartmentId`) REFERENCES compartments (id) ON DELETE SET NULL, CHECK (`allowAnyGroup` IN (0, 1)) ) engine=ndbcluster;
ERROR 1215 (HY000): Cannot add foreign key constraint
mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1296 | Got error 21034 'Create foreign key failed - child table has Blob or Text column and on-delete-cascade is not allowed' from NDB |
| Error | 1215 | Cannot add foreign key constraint |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: ERROR 1005 (HY000): Can't create table
242
March 05, 2021 03:54AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.