[MDEV-29960] With some character sets default value of binary column is displayed incorrectly Created: 2022-11-06  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

With sjis for a client character set (maybe with others, too), an empty default value of a binary column, which is usually a line of zero-characters, shows some garbage instead, and thus an attempt to re-create the table using the displayed CREATE TABLE fails with ER_INVALID_DEFAULT.

10.3 92be8d20

MariaDB [test]> create table t (a binary default '');
Query OK, 0 rows affected (0.044 sec)
 
MariaDB [test]> set names sjis;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> show create table t;
+-------+-------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                      |
+-------+-------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` binary(1) DEFAULT '�_0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci  |
+-------+-------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
 
MariaDB [test]> set names utf8;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [test]> show create table t;
+-------+------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                     |
+-------+------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` binary(1) DEFAULT '\0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci |
+-------+------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)


Generated at Thu Feb 08 10:12:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.