[MDEV-29968] Functions in default values in tables with some character sets break SHOW CREATE (and mysqldump) Created: 2022-11-07  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: Major
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

CREATE TABLE t (a CHAR(8) DEFAULT REVERSE('aha')) CHARACTER SET utf32;
 
--echo # In MTR
SHOW CREATE TABLE t;
--echo # In the command line client
--exec $MYSQL test -e "SHOW CREATE TABLE t"
--echo # In mysqldump
--exec $MYSQL_DUMP test > $MYSQL_TMP_DIR/1.dump
--cat_file $MYSQL_TMP_DIR/1.dump
DROP TABLE t;

In MTR, the output of SHOW CREATE looks all right, but the client and the dump demonstrate the problem:

10.3 92be8d20

# In the command line client
Table	Create Table
t	CREATE TABLE `t` (\n  `a` char(8) DEFAULT \0\0\0r\0\0\0e\0\0\0v\0\0\0e\0\0\0r\0\0\0s\0\0\0e('aha')\n) ENGINE=MyISAM DEFAULT CHARSET=utf32 COLLATE=utf32_general_ci
 
# In mysqldump
...
CREATE TABLE `t` (
  `a` char(8) DEFAULT ;
/*!40101 SET character_set_client = @saved_cs_client */;

Reproducible on all of 10.3-10.11, and 10.2 too; seemingly with any function for a default of a string column.


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