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
1816
December 20, 2020 10:28AM
Re: ERROR 1005 (HY000): Can't create table
860
March 05, 2021 03:54AM


Sorry, you can't reply to this topic. It has been closed.

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.