Bug #101330 On adding Foreign key gives error 3780
Submitted: 27 Oct 4:15 Modified: 27 Oct 6:36
Reporter: Abhijeet Singh Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Workbench Severity:S3 (Non-critical)
Version:8.0.22 OS:Microsoft Windows (Microsoft Windows 10 Home Single Language)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[27 Oct 4:15] Abhijeet Singh
Description:
----[For better reports, please attach the log file after submitting. You can find it in C:\Users\abhij\AppData\Roaming\MySQL\Workbench\log\wb.log]

09:37:50	CREATE TABLE Employee( EmpId INT NOT NULL AUTO_INCREMENT, EmpName VARCHAR(40) NOT NULL, Designation VARCHAR(40) NOT NULL, City VARCHAR (20) NOT NULL, Salary VARCHAR(10) NOT NULL, PRIMARY KEY(EmpId), FOREIGN KEY(City) REFERENCES City(Cid) )	Error Code: 3780. Referencing column 'City' and referenced column 'Cid' in foreign key constraint 'employee_ibfk_1' are incompatible.	0.031 sec

How to repeat:
09:37:50	CREATE TABLE Employee( EmpId INT NOT NULL AUTO_INCREMENT, EmpName VARCHAR(40) NOT NULL, Designation VARCHAR(40) NOT NULL, City VARCHAR (20) NOT NULL, Salary VARCHAR(10) NOT NULL, PRIMARY KEY(EmpId), FOREIGN KEY(City) REFERENCES City(Cid) )	Error Code: 3780. Referencing column 'City' and referenced column 'Cid' in foreign key constraint 'employee_ibfk_1' are incompatible.	0.031 sec
[27 Oct 6:36] MySQL Verification Team
Hello Abhijeet Singh,

Thank you for the bug report.
Imho this is not a bug. City in Employee table is varchar and referencing it to Cid from City table. Both datatype should be of same type while referencing.

Regards,
Ashwini Patil