我试图在workbench中向前设计一个er图来创建我的模式,但我得到了一个错误。我正在使用mysql workbench for mac。
这是我收到的错误信息:
Executing SQL script in server
ERROR: Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '
INDEX `city_id_fk_idx` (`city_id` ASC) VISIBLE,
INDEX `county_id_idx` (`cou' at line 13
SQL Code:
-- -----------------------------------------------------
-- Table `k00243666_property_bubble`.`addresses`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `k00243666_property_bubble`.`addresses` (
`address_id` INT NOT NULL AUTO_INCREMENT,
`address1` VARCHAR(45) NULL,
`address2` VARCHAR(45) NULL,
`eircode` VARCHAR(7) NULL,
`town_id` INT NULL,
`city_id` INT NULL,
`county_id` INT NULL,
PRIMARY KEY (`address_id`),
INDEX `town_id_fk_idx` (`town_id` ASC) VISIBLE,
INDEX `city_id_fk_idx` (`city_id` ASC) VISIBLE,
INDEX `county_id_idx` (`county_id` ASC) VISIBLE,
CONSTRAINT `town_id_fk`
FOREIGN KEY (`town_id`)
REFERENCES `k00243666_property_bubble`.`town` (`town_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT `city_id_fk`
FOREIGN KEY (`city_id`)
REFERENCES `k00243666_property_bubble`.`city` (`city_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE,
CONSTRAINT `county_id`
FOREIGN KEY (`county_id`)
REFERENCES `k00243666_property_bubble`.`county` (`county_id`)
ON DELETE NO ACTION
ON UPDATE CASCADE)
ENGINE = InnoDB
SQL script execution finished: statements: 5 succeeded, 1 failed
Fetching back view definitions in final form.
Nothing to fetch
有人知道我为什么会犯这个错误吗?
1条答案
按热度按时间jecbmhm31#
我猜你的mariadb版本不支持
VISIBLE
或者INVISIBLE
应用于索引定义。在任何情况下,索引在默认情况下都应该是可见的,因此您甚至不需要指定VISIBLE
. 尝试使用以下语法:下面是一个链接,指向向mariadb发出的功能请求。似乎没有
INVISIBLE
关闭优化器索引的语法。但是,它提供了一种替代方案:这将使优化器看不到所有索引。