Bug #101270 Error 1064: create table with foreign key
Submitted: 22 Oct 4:39 Modified: 28 Oct 11:00
Reporter: Dung Nguyen Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Workbench Severity:S7 (Test Cases)
Version:8.0.21 OS:Microsoft Windows (Microsoft Windows 10 Pro)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[22 Oct 4:39] Dung Nguyen
Description:
----[For better reports, please attach the log file after submitting. You can find it in C:\Users\User\AppData\Roaming\MySQL\Workbench\log\wb.log]

11:34:47 [ERR][  GRTDispatcher]: exception in grt execute_task, continuing: Exception: There was an error while applying the SQL script to the database.
11:34:47 [ERR][  GRTDispatcher]: worker: task 'wizard task' has failed with error:.There was an error while applying the SQL script to the database.
11:34:53 [ERR][SQL Editor Form]: 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 '
  UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
  PRIMARY KEY (`id`),
  CONST...' at line 5
SQL Statement:
CREATE TABLE `employee`.`phone` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `phone_number` VARCHAR(45) NULL,
  `employee_id` INT NULL,
  INDEX `fk_phone_1_idx` (`employee_id` ASC) VISIBLE,
  UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
  PRIMARY KEY (`id`),
  CONSTRAINT `fk_phone_1`
    FOREIGN KEY (`employee_id`)
    REFERENCES `employee`.`employee` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8

How to repeat:
11:34:47 [ERR][  GRTDispatcher]: exception in grt execute_task, continuing: Exception: There was an error while applying the SQL script to the database.
11:34:47 [ERR][  GRTDispatcher]: worker: task 'wizard task' has failed with error:.There was an error while applying the SQL script to the database.
11:34:53 [ERR][SQL Editor Form]: 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 '
  UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
  PRIMARY KEY (`id`),
  CONST...' at line 5
SQL Statement:
CREATE TABLE `employee`.`phone` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `phone_number` VARCHAR(45) NULL,
  `employee_id` INT NULL,
  INDEX `fk_phone_1_idx` (`employee_id` ASC) VISIBLE,
  UNIQUE INDEX `id_UNIQUE` (`id` ASC) VISIBLE,
  PRIMARY KEY (`id`),
  CONSTRAINT `fk_phone_1`
    FOREIGN KEY (`employee_id`)
    REFERENCES `employee`.`employee` (`id`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
[28 Oct 11:00] MySQL Verification Team
Hello Dung Nguyen,

Thank you for the bug report.
Imho this is duplicate of Bug #95804, please see Bug #95804.

Regards,
Ashwini Patil
[5 Nov 18:23] Brian Plunkett
Ashwini Patil, please note that this is not the same type of error.  MySQL does not support MariaDB databases (i.e. different database architecture & syntax from MySQL).  The ticket should be closed.