| Bug #81364 | Indexing JSON column should suggest generated columns | ||
|---|---|---|---|
| Submitted: | 10 May 2016 13:05 | Modified: | 28 Oct 2016 11:53 |
| Reporter: | Morgan Tocker | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: JSON | Severity: | S4 (Feature request) |
| Version: | 8.0.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[12 May 2016 9:48]
MySQL Verification Team
Hello Morgan, Thank you for the feature request! Thanks, Umesh
[18 Jun 2016 21:37]
Omer Barnir
Posted by developer: Reported version value updated to reflect release name change from 5.8 to 8.0
[28 Oct 2016 11:53]
Jon Stephens
Thanks, Morgan!
Fixed in MySQL 8.0.1. Documented in the changelog as follows:
The error message for Error 3152 ER_JSON_USED_AS_KEY has been
changed from -JSON column '%s' cannot be used in key
specification- to the less confusing and more accurate -JSON
column '%s' supports indexing only via generated columns on a
specified JSON path.-
(Also confirmed with Paul that the updated error message now appears on
https://dev.mysql.com/doc/refman/8.0/en/error-messages-server.html.)
Closed.

Description: There is some confusion over whether or not JSON supports indexing. The error message when adding an index on a JSON column could be improved. How to repeat: mysql [localhost] {msandbox} (test1) > CREATE TABLE t1 (a int not null primary key, b json, index(b)); ERROR 3152 (42000): JSON column 'b' cannot be used in key specification. Suggested fix: It should be: JSON column 'b' supports indexing only via generated columns on a specified json path.