Quantcast
Channel: MySQL Forums - NDB clusters
Viewing all articles
Browse latest Browse all 1560

Cannot add unique constraint with fk column (3 replies)

$
0
0
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!

Viewing all articles
Browse latest Browse all 1560

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>