Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
Description
If I insert an incomplete multi-byte character into a table:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis); |
INSERT INTO t1 VALUES (0x8FA1); |
SHOW WARNINGS;
|
SELECT HEX(a) FROM t1; |
it correctly returns a warning:
+---------+------+------------------------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+------------------------------------------------------------+
|
| Warning | 1366 | Incorrect string value: '\x8F\xA1' for column 'a' at row 1 |
|
+---------+------+------------------------------------------------------------+
|
and translates every byte in the incomplete sequence to QUESTION MARK:
+--------+
|
| HEX(a) |
|
+--------+
|
| 3F3F |
|
+--------+
|
If I put the same sequence into a file:
printf "\x8F\xA1"> /tmp/test.txt
|
and load it:
DELETE FROM t1; |
LOAD DATA INFILE '/tmp/test.txt' INTO TABLE t1 CHARACTER SET ujis; |
SELECT HEX(a) FROM t1; |
it returns no warnings and truncates the incomplete sequence:
+--------+
|
| HEX(a) |
|
+--------+
|
| |
|
+--------+
|
LOAD should be fixed to work consistently with INSERT.
Attachments
Issue Links
- blocks
-
MDEV-6353 my_ismbchar() and my_mbcharlen() refactoring
-
- Closed
-
Activity
Description |
If I insert an incomplete multi-byte character into a table:
{code:sql} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis); INSERT INTO t1 VALUES (0x8FA1); SHOW WARNINGS; SELECT HEX(a) FROM t1; {code:sql} it correctly returns a warning: {noformat} +---------+------+------------------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------------------+ | Warning | 1366 | Incorrect string value: '\x8F\xA1' for column 'a' at row 1 | +---------+------+------------------------------------------------------------+ {noformat} and translates every byte in the incomplete sequence to QUESTION MARK: {noformat} +--------+ | HEX(a) | +--------+ | 3F3F | +--------+ {noformat} If I put the same sequence into a file: {code:shell} printf "\x8F\xA1"> /tmp/test.txt {code} and load it: {code:sql} DELETE FROM t1; LOAD DATA INFILE '/tmp/test.txt' INTO TABLE t1 CHARACTER SET ujis; SELECT HEX(a) FROM t1; {code} it returns no warnings and truncates the incomplete sequence: {noformat} +--------+ | HEX(a) | +--------+ | | +--------+ {noformat} LOAD should be fixed to work consistently with INSERT. |
If I insert an incomplete multi-byte character into a table:
{code:sql} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ujis); INSERT INTO t1 VALUES (0x8FA1); SHOW WARNINGS; SELECT HEX(a) FROM t1; {code} it correctly returns a warning: {noformat} +---------+------+------------------------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------------------------+ | Warning | 1366 | Incorrect string value: '\x8F\xA1' for column 'a' at row 1 | +---------+------+------------------------------------------------------------+ {noformat} and translates every byte in the incomplete sequence to QUESTION MARK: {noformat} +--------+ | HEX(a) | +--------+ | 3F3F | +--------+ {noformat} If I put the same sequence into a file: {code:shell} printf "\x8F\xA1"> /tmp/test.txt {code} and load it: {code:sql} DELETE FROM t1; LOAD DATA INFILE '/tmp/test.txt' INTO TABLE t1 CHARACTER SET ujis; SELECT HEX(a) FROM t1; {code} it returns no warnings and truncates the incomplete sequence: {noformat} +--------+ | HEX(a) | +--------+ | | +--------+ {noformat} LOAD should be fixed to work consistently with INSERT. |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Alexander Barkov [ bar ] | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Sergei Golubchik [ serg ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Assignee | Alexander Barkov [ bar ] | Sergei Golubchik [ serg ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Assignee | Sergei Golubchik [ serg ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.2.0 [ 20700 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 74691 ] | MariaDB v4 [ 150270 ] |