Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0.21
-
None
-
Seen on both OS X 10.9 and Ubuntu 14.04
-
10.2.11
Description
Possibly related to MDEV-461.
When calling column_create with names set to utf8, one can successfully
encode an emoji that takes 4 bytes in utf-8:
adamj@localhost [1]> set names utf8;
|
adamj@localhost [2]> select column_json(column_create('��', 1));
|
+---------------------------------------+
|
| column_json(column_create('��', 1)) |
|
+---------------------------------------+
|
| {"��":1} |
|
+---------------------------------------+
|
However if the connection is set to utf8mb4 this actually fails,
counter-intuitively:
adamj@localhost [3]> set names utf8mb4;
|
adamj@localhost [4]> select column_json(column_create('��', 1));
|
+------------------------------------+
|
| column_json(column_create('?', 1)) |
|
+------------------------------------+
|
| {"?":1} |
|
+------------------------------------+
|
|
adamj@localhost [5]> select column_list(column_create('��', 1));
|
+------------------------------------+
|
| column_list(column_create('?', 1)) |
|
+------------------------------------+
|
| `?` |
|
+------------------------------------+
|
Other unicode characters work fine though:
adamj@localhost [6]> select column_list(column_create('❤', 1));
|
+--------------------------------------+
|
| column_list(column_create('❤', 1)) |
|
+--------------------------------------+
|
| `❤` |
|
+--------------------------------------+
|
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
Possibly related to When calling {{column_create}} with names set to {{utf8}}, one can successfully encode an emoji that takes 4 bytes in utf-8: {{ adamj@localhost [1]> set names utf8; adamj@localhost [2]> select column_json(column_create('��', 1)); +---------------------------------------+ | column_json(column_create('��', 1)) | +---------------------------------------+ | {"��":1} | +---------------------------------------+ }} However if the connection is set to {{utf8mb4}} this actually fails, counter-intuitively: {{ adamj@localhost [3]> set names utf8mb4; adamj@localhost [4]> select column_json(column_create('��', 1)); +------------------------------------+ | column_json(column_create('?', 1)) | +------------------------------------+ | {"?":1} | +------------------------------------+ adamj@localhost [5]> select column_list(column_create('��', 1)); +------------------------------------+ | column_list(column_create('?', 1)) | +------------------------------------+ | `?` | +------------------------------------+ }} Other unicode characters work fine still though: {{ adamj@localhost [6]> select column_list(column_create('❤', 1)); +--------------------------------------+ | column_list(column_create('❤', 1)) | +--------------------------------------+ | `❤` | +--------------------------------------+ }} |
Possibly related to When calling {{column_create}} with names set to {{utf8}}, one can successfully encode an emoji that takes 4 bytes in utf-8: {code} adamj@localhost [1]> set names utf8; adamj@localhost [2]> select column_json(column_create('��', 1)); +---------------------------------------+ | column_json(column_create('��', 1)) | +---------------------------------------+ | {"��":1} | +---------------------------------------+ {code} However if the connection is set to {{utf8mb4}} this actually fails, counter-intuitively: {code} adamj@localhost [3]> set names utf8mb4; adamj@localhost [4]> select column_json(column_create('��', 1)); +------------------------------------+ | column_json(column_create('?', 1)) | +------------------------------------+ | {"?":1} | +------------------------------------+ adamj@localhost [5]> select column_list(column_create('��', 1)); +------------------------------------+ | column_list(column_create('?', 1)) | +------------------------------------+ | `?` | +------------------------------------+ {code} Other unicode characters work fine though: {code} adamj@localhost [6]> select column_list(column_create('❤', 1)); +--------------------------------------+ | column_list(column_create('❤', 1)) | +--------------------------------------+ | `❤` | +--------------------------------------+ {code} |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Alexander Barkov [ bar ] |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.2 [ 14601 ] |
Assignee | Alexander Barkov [ bar ] |
Assignee | Oleksandr Byelkin [ sanja ] |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Sprint | 10.2.11 [ 203 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Assignee | Oleksandr Byelkin [ sanja ] | Alexander Barkov [ bar ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Assignee | Alexander Barkov [ bar ] | Oleksandr Byelkin [ sanja ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.0.34 [ 22613 ] | |
Fix Version/s | 10.1.29 [ 22636 ] | |
Fix Version/s | 10.2.11 [ 22634 ] | |
Fix Version/s | 10.3.3 [ 22644 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 72124 ] | MariaDB v4 [ 149714 ] |
Reproducible as described.
There is also a simpler example which does not involve dynamic columns but might have the same root cause (or not?):
MySQL [test]> set names utf8;
Query OK, 0 rows affected (0.00 sec)
MySQL [test]> select '��';
+------+
| �� |
+------+
| �� |
+------+
1 row in set (0.00 sec)
MySQL [test]> set names utf8mb4;
Query OK, 0 rows affected (0.00 sec)
MySQL [test]> select '��';
+------+
| ? |
+------+
| �� |
+------+
1 row in set (0.00 sec)
Note the difference in the column name.
Reproducible on MySQL as well.
Assigning to bar who should be able to shed some light on it.