[MDEV-27661] Incorrect information in file: ... #sql-alter ... .frm on ALTER Created: 2022-01-28  Updated: 2023-08-13

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

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: corruption


 Description   

SET @@character_set_server=1;
DROP DATABASE test;
CREATE DATABASE test;
USE test;
CREATE TABLE t (c1 BLOB);
ALTER TABLE t ADD c CHAR(30) CHARACTER SET latin1 DEFAULT CONCAT ('ß');

Leads to:

10.8.0 e222e44d1bfc995870430bb90d8ac97e91f66cb4 (Optimized)

10.8.0-opt>ALTER TABLE t ADD c CHAR(30) CHARACTER SET latin1 DEFAULT CONCAT ('ß');
ERROR 1918 (22007): Encountered illegal value 'ß' when converting to big5

And

10.8.0 e222e44d1bfc995870430bb90d8ac97e91f66cb4 (Optimized)

2022-01-28 18:58:28 0 [Note] /test/MD190122-mariadb-10.8.0-linux-x86_64-opt/bin/mysqld: ready for connections.
Version: '10.8.0-MariaDB'  socket: '/test/MD190122-mariadb-10.8.0-linux-x86_64-opt/socket.sock'  port: 37496  MariaDB Server
2022-01-28 18:58:28 4 [ERROR] mysqld: Incorrect information in file: './test/#sql-alter-1711b9-4.frm'

10.8.0 e222e44d1bfc995870430bb90d8ac97e91f66cb4 (Debug)

2022-01-28 18:58:17 0 [Note] /test/MD190122-mariadb-10.8.0-linux-x86_64-dbg/bin/mysqld: ready for connections.
Version: '10.8.0-MariaDB-debug'  socket: '/test/MD190122-mariadb-10.8.0-linux-x86_64-dbg/socket.sock'  port: 30035  MariaDB Server
2022-01-28 18:58:18 4 [ERROR] mysqld: Incorrect information in file: './test/#sql-alter-16f8fb-4.frm'



 Comments   
Comment by Alexander Barkov [ 2022-01-28 ]

A simpler script (without system variables) reproducing the same problem:

SET NAMES utf8;
DROP DATABASE IF EXISTS test_big5;
CREATE DATABASE test_big5 DEFAULT CHARACTER SET big5;
CREATE TABLE test_big5.t (c1 BLOB);
ALTER TABLE test_big5.t ADD c2 CHAR(30) CHARACTER SET latin1 DEFAULT CONCAT ('ß');

Comment by Alexander Barkov [ 2022-01-28 ]

Even simpler test, without a separate database:

USE test;
SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BLOB) DEFAULT CHARACTER SET big5;
ALTER TABLE t1 ADD c2 CHAR(30) CHARACTER SET latin1 DEFAULT CONCAT ('ß');

Comment by Alexander Barkov [ 2022-01-28 ]

A related problem:

SET NAMES utf8;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 BLOB, c2 CHAR(30) CHARACTER SET latin1 DEFAULT CONCAT (_utf8mb3'ß')) DEFAULT CHARACTER SET big5;
SHOW CREATE TABLE t1;

+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                   |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `c1` blob DEFAULT NULL,
  `c2` char(30) CHARACTER SET latin1 DEFAULT concat(_utf8mb3'xC3x83xC5xB8')
) ENGINE=InnoDB DEFAULT CHARSET=big5 |
+-------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+

Notice, the default value in c2 in the SHOW CREATE output is wrong.

But the inserted default value looks correct:

INSERT INTO t1 VALUES ();
SELECT * FROM t1;

+------+------+
| c1   | c2   |
+------+------+
| NULL | ß   |
+------+------+

Comment by Elena Stepanova [ 2023-08-13 ]

Another probably related problem:

CREATE TABLE t (
  a enum('foo','bar') CHARACTER SET utf32,
  b enum('foo','bar') CHARACTER SET utf8mb3
);
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb3;
 
# Cleanup
DROP TABLE t;

10.4 b54e4bf0

query 'ALTER TABLE t CONVERT TO CHARACTER SET utf8mb3' failed: 1033: Incorrect information in file: './test/#sql-32ff38_4.frm'

Generated at Thu Feb 08 09:54:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.