MySQL Forums
Forum List  »  NDB clusters

Cannot add unique constraint with fk column
Posted by: Vladislav Belogrudov
Date: June 17, 2015 07:22AM

Hi,

I try to get NDB working with OpenStack and found the following code not working:

==========

CREATE TABLE networks (
tenant_id VARCHAR(255),
id VARCHAR(36) NOT NULL,
name VARCHAR(255),
status VARCHAR(16),
admin_state_up BOOL,
shared BOOL,
PRIMARY KEY (id)
);


CREATE TABLE ports (
tenant_id VARCHAR(255),
id VARCHAR(36) NOT NULL,
name VARCHAR(255),
network_id VARCHAR(36) NOT NULL,
mac_address VARCHAR(32) NOT NULL,
admin_state_up BOOL NOT NULL,
status VARCHAR(16) NOT NULL,
device_id VARCHAR(255) NOT NULL,
device_owner VARCHAR(255) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY(network_id) REFERENCES networks (id)
);


ALTER TABLE ports ADD CONSTRAINT uniq_ports0network_id0mac_address UNIQUE (network_id, mac_address);

============

This gives me ERROR 1296 (HY000): Got error 4243 'Index not found' from NDBCLUSTER

I have played a bit with the code and if I add KEY (network_id) for 'ports' creation everything works. Just puzzled whether this is a bug or a specified behavior.. If the latter is true I will have to convince OpenStack developers to add necessary key.

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Cannot add unique constraint with fk column
2516
June 17, 2015 07:22AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

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.