Wrong warning message during foreign key creation failure (not compatible charset)

Bug #1705229 reported by Arturas Moskvinas
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Triaged
Medium
Unassigned
5.6
Triaged
Medium
Unassigned
5.7
Triaged
Medium
Unassigned

Bug Description

Percona Server 5.6 report misleading warning when foreign key creation fails due to incompatible foreign key character set.

Reproduction:
test> create table a(id varchar(1) character set utf8mb4, primary key(id));
test> create table b(id varchar(1) character set utf8, b_id varchar(1) character set utf8, primary key(id), CONSTRAINT a_fkey FOREIGN KEY (b_id) REFERENCES a (id));
ERROR 1215 (HY000): Cannot add foreign key constraint
test> show warnings
```
root@perconatraindb03-sjc1 test> show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 150 | Create table 'test/b' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns.
 |
| Error | 1215 | Cannot add foreign key constraint |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)
```

Expected:
Something more meaningful than column not appearing in index a first column.

Tags: upstream
Revision history for this message
Arturas Moskvinas (arturas-w) wrote :

Tested on Percona server 5.6.36

Changed in percona-server:
assignee: nobody → Sveta Smirnova (svetasmirnova)
Revision history for this message
Sveta Smirnova (svetasmirnova) wrote :

Thank you for the reasonable feature request.

tags: added: upstream
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1811

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.