I don't understand this behavior and am hoping someone can enlighten me...
mysql> CREATE TABLE test (id INT AUTO_INCREMENT, data JSON, PRIMARY KEY(id));
Query OK, 0 rows affected (0.03 sec)
mysql> INSERT INTO test(data) VALUES ('["\\u0000\"]'), ('["\\u0001"]'), ('["\\u0081"]'), ('["\\u0091"]');
Query OK, 4 rows affected (0.09 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> select *,char_length(data),hex(data) from test;
+----+------------+-------------------+----------------------+
| id | data | char_length(data) | hex(data) |
+----+------------+-------------------+----------------------+
| 1 | ["\u0000"] | 10 | 5B225C7530303030225D |
| 2 | ["\u0001"] | 10 | 5B225C7530303031225D |
| 3 | [""] | 5 | 5B22C281225D |
| 4 | [""] | 5 | 5B22C291225D |
+----+------------+-------------------+----------------------+
4 rows in set (0.00 sec)
Why does MySQL choose to parse \\u0081 as a code point, but leave \\u0001 as a series of simple characters?
Or taken the other way, why does MySQL parse the "\\" in the latter case as "It's a literal backslash character," but parse the "\\" in the former case as a reason to interpret the following characters? I can see arguments for either approach, but I'm confounded by the change in behavior between \u0001 and \u0081.
This is on "mysql Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using EditLine wrapper" as well as "mysql Ver 8.0.12 for macos10.13 on x86_64 (MySQL Community Server - GPL)". It shows up on the MySQL command line, as shown here, as well as via PDO.
As always, my apologies if this question is addressed elsewhere. I found many related issues but none that addressed this inconsistency (or for Bug 87722, it claims to have been fixed, but doesn't seem to be).