MySQL Forums
Forum List  »  NDB clusters

Re: ERROR 1005 (HY000): Can't create table
Posted by: Pete Ditmars
Date: December 21, 2020 10:37PM

ok, it seems to fail on the foreign key "policyId"... specifically on the "ON DELETE CASCADE" part.

Is that not allowed in NDB CLUSTER?

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,
-> CHECK (`allowAnyGroup` IN (0, 1))
-> ) ;
ERROR 1215 (HY000): Cannot add foreign key constraint

mysql> describe policies;
+----------------+-----------------------------------------------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-----------------------------------------------------------+------+-----+---------+-------+
| isAdmin | tinyint(1) | YES | | 0 | |
| versionDate | varchar(10) | YES | | NULL | |
| id | varchar(255) | NO | PRI | NULL | |
| name | varchar(100) | NO | | NULL | |
| description | varchar(400) | NO | | NULL | |
| etag | int | YES | | 1 | |
| timeCreated | datetime | YES | | NULL | |
| lifecycleState | enum('CREATING','ACTIVE','INACTIVE','DELETING','DELETED') | NO | | ACTIVE | |
| inactiveStatus | int | YES | | 0 | |
| compartmentId | varchar(255) | YES | MUL | NULL | |
+----------------+-----------------------------------------------------------+------+-----+---------+-------+

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),
-> CHECK (`allowAnyGroup` IN (0, 1))
-> ) ;
Query OK, 0 rows affected (0.22 sec)

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: ERROR 1005 (HY000): Can't create table
299
December 21, 2020 10:37PM


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.