[MDEV-22111] ERROR 1064 & 1033 and SIGSEGV on CREATE TABLE w/ various charsets on 10.4/5 optimized builds | Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed Created: 2020-04-01  Updated: 2022-06-16  Resolved: 2020-05-22

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Create Table
Affects Version/s: 10.1, 10.5.4, 10.2, 10.3, 10.4
Fix Version/s: 10.5.4, 10.1.46, 10.2.33, 10.3.24, 10.4.14

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: affects-tests, regression

Issue Links:
Duplicate
is duplicated by MDEV-22499 Assertion `(uint) (table_check_constr... Closed
Relates
relates to MDEV-20902 Table with two UCS2 ENUM or SET field... Open
relates to MDEV-28498 Incorrect information in file: './tes... In Review

 Description   

USE test;
SET @@SESSION.COLLATION_CONNECTION=utf16_hungarian_ci;
CREATE TABLE t(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON);   # ERROR 1064 (42000): You have an error in your SQL syntax
CREATE TABLE t(c ENUM('aaaaaaaaa') CHARACTER SET 'Binary',d JSON);   # ERROR 1033 (HY000): Incorrect information in file: './test/t.frm'
CREATE TABLE t(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON);   # Sig 11

All three queries succeed on MySQL 8.0 without warnings (opt+dbg tested).

Sig 11 (from last query) backtrace;

Core was generated by `/data/MD180320-mariadb-10.5.2-linux-x86_64-opt/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f82aa6a6700 (LWP 4464))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=11)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x0000564ed4087877 in my_write_core (sig=sig@entry=11)
    at /data/git/10.5_opt/mysys/stacktrace.c:518
#2  0x0000564ed3a4615a in handle_fatal_signal (sig=11) at /data/git/10.5_opt/sql/signal_handler.cc:325
#3  <signal handler called>
#4  0x0000564ed390b2d0 in TABLE_SHARE::init_from_binary_frm_image (this=this@entry=0x7f82aa6a3c80, 
    thd=thd@entry=0x7f8272c12018, write=<optimized out>, frm_image=<optimized out>, 
    frm_length=<optimized out>) at /data/git/10.5_opt/sql/table.cc:3031
#5  0x0000564ed3a4fc20 in ha_create_table (thd=thd@entry=0x7f8272c12018, 
    path=path@entry=0x7f82aa6a4940 "./test/t", db=0x7f8272c47850 "test", 
    table_name=0x7f8272c47148 "t", create_info=create_info@entry=0x7f82aa6a4d20, 
    frm=frm@entry=0x7f82aa6a4930) at /data/git/10.5_opt/sql/handler.cc:5300
#6  0x0000564ed38e52ea in create_table_impl (thd=thd@entry=0x7f8272c12018, orig_db=..., 
    orig_table_name=..., db=..., table_name=..., path=path@entry=0x7f82aa6a4940 "./test/t", 
    options=..., create_info=0x7f82aa6a4d20, alter_info=0x7f82aa6a4c50, create_table_mode=0, 
    is_trans=0x7f82aa6a4bc7, key_info=0x7f82aa6a4928, key_count=0x7f82aa6a4924, frm=0x7f82aa6a4930)
    at /data/git/10.5_opt/sql/sql_table.cc:5084
#7  0x0000564ed38e568b in mysql_create_table_no_lock (thd=thd@entry=0x7f8272c12018, 
    db=db@entry=0x7f8272c47198, table_name=table_name@entry=0x7f8272c471a8, 
    create_info=create_info@entry=0x7f82aa6a4d20, alter_info=0x7f82aa6a4c50, 
    is_trans=is_trans@entry=0x7f82aa6a4bc7, create_table_mode=0, table_list=0x7f8272c47180)
    at /data/git/10.5_opt/sql/sql_table.cc:5168
#8  0x0000564ed38e58a1 in mysql_create_table (thd=thd@entry=0x7f8272c12018, 
    create_table=create_table@entry=0x7f8272c47180, create_info=create_info@entry=0x7f82aa6a4d20, 
    alter_info=alter_info@entry=0x7f82aa6a4c50) at /data/git/10.5_opt/sql/sql_table.cc:5260
#9  0x0000564ed38e6c46 in Sql_cmd_create_table_like::execute (this=<optimized out>, 
    thd=0x7f8272c12018) at /data/git/10.5_opt/sql/sql_table.cc:11592
#10 0x0000564ed38511b4 in mysql_execute_command (thd=thd@entry=0x7f8272c12018)
    at /data/git/10.5_opt/sql/sql_parse.cc:5887
#11 0x0000564ed38590bc in mysql_parse (thd=thd@entry=0x7f8272c12018, rawbuf=<optimized out>, 
    length=66, parser_state=parser_state@entry=0x7f82aa6a54d0, is_com_multi=is_com_multi@entry=false, 
    is_next_command=is_next_command@entry=false) at /data/git/10.5_opt/sql/sql_parse.cc:7926
#12 0x0000564ed384e049 in dispatch_command (command=command@entry=COM_QUERY, 
    thd=thd@entry=0x7f8272c12018, 
    packet=packet@entry=0x7f8272c3a019 "CREATE TABLE t(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON)", packet_length=packet_length@entry=66, is_com_multi=is_com_multi@entry=false, 
    is_next_command=is_next_command@entry=false) at /data/git/10.5_opt/sql/sql_parse.cc:1839
#13 0x0000564ed384c3c0 in do_command (thd=0x7f8272c12018) at /data/git/10.5_opt/sql/sql_parse.cc:1358
#14 0x0000564ed39403ae in do_handle_one_connection (connect=<optimized out>, 
    connect@entry=0x7f82a78329b8, put_in_cache=put_in_cache@entry=true)
    at /data/git/10.5_opt/sql/sql_connect.cc:1422
#15 0x0000564ed3940554 in handle_one_connection (arg=arg@entry=0x7f82a78329b8)
    at /data/git/10.5_opt/sql/sql_connect.cc:1319
#16 0x0000564ed3caf02a in pfs_spawn_thread (arg=0x7f82a784b018)
    at /data/git/10.5_opt/storage/perfschema/pfs.cc:2201
#17 0x00007f82a91596db in start_thread (arg=0x7f82aa6a6700) at pthread_create.c:463
#18 0x00007f82a855788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.13 (opt), 10.5.2 (opt), 10.5.4 (opt)

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (dbg), 10.5.2 (dbg)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Roel Van de Paar [ 2020-04-01 ]

Further research shows the bug also, in another way, reproduces in 10.4 debug. Here it immediately raises an assertion on the first query.

mysqld: /data/git/10.4_dbg/sql/table.cc:2934: int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t): Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed.

Core was generated by `/data/MD140320-mariadb-10.4.13-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f44c7ccc700 (LWP 826))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x00005615766021ed in my_write_core (sig=sig@entry=6) at /data/git/10.4_dbg/mysys/stacktrace.c:481
#2  0x0000561575d90e7c in handle_fatal_signal (sig=6) at /data/git/10.4_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f44c618d801 in __GI_abort () at abort.c:79
#6  0x00007f44c617d39a in __assert_fail_base (
    fmt=0x7f44c63047d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5615766f5100 "(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)", 
    file=file@entry=0x5615766f4ab8 "/data/git/10.4_dbg/sql/table.cc", line=line@entry=2934, 
    function=function@entry=0x5615766f8340 <TABLE_SHARE::init_from_binary_frm_image(THD*, bool, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t)") at assert.c:92
#7  0x00007f44c617d412 in __GI___assert_fail (
    assertion=assertion@entry=0x5615766f5100 "(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)", 
    file=file@entry=0x5615766f4ab8 "/data/git/10.4_dbg/sql/table.cc", line=line@entry=2934, 
    function=function@entry=0x5615766f8340 <TABLE_SHARE::init_from_binary_frm_image(THD*, bool, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t)") at assert.c:101
#8  0x0000561575bb9f5c in TABLE_SHARE::init_from_binary_frm_image (this=this@entry=0x7f44c7cc7150, 
    thd=thd@entry=0x7f4481c15070, write=<optimized out>, frm_image=<optimized out>, 
    frm_length=<optimized out>) at /data/git/10.4_dbg/sql/table.cc:2932
#9  0x0000561575da028d in ha_create_table (thd=thd@entry=0x7f4481c15070, 
    path=path@entry=0x7f44c7cc7fa0 "./test/t", db=0x7f4481c6d890 "test",
    table_name=0x7f4481c6d198 "t", create_info=create_info@entry=0x7f44c7cc83e0, 
    frm=frm@entry=0x7f44c7cc7f90) at /data/git/10.4_dbg/sql/handler.cc:5172
#10 0x0000561575b89df2 in create_table_impl (thd=thd@entry=0x7f4481c15070, orig_db=..., 
    orig_table_name=..., db=..., table_name=..., path=path@entry=0x7f44c7cc7fa0 "./test/t", 
    options=..., create_info=0x7f44c7cc83e0, alter_info=0x7f44c7cc8320, create_table_mode=0, 
    is_trans=0x7f44c7cc8227, key_info=0x7f44c7cc7f88, key_count=0x7f44c7cc7f84, frm=0x7f44c7cc7f90)
    at /data/git/10.4_dbg/sql/sql_table.cc:5065
#11 0x0000561575b8a38a in mysql_create_table_no_lock (thd=thd@entry=0x7f4481c15070, 
    db=db@entry=0x7f4481c6d1e8, table_name=table_name@entry=0x7f4481c6d1f8, 
    create_info=create_info@entry=0x7f44c7cc83e0, alter_info=alter_info@entry=0x7f44c7cc8320, 
    is_trans=is_trans@entry=0x7f44c7cc8227, create_table_mode=0, table_list=0x7f4481c6d1d0)
    at /data/git/10.4_dbg/sql/sql_table.cc:5149
#12 0x0000561575b8a6d1 in mysql_create_table (thd=thd@entry=0x7f4481c15070, 
    create_table=create_table@entry=0x7f4481c6d1d0, create_info=create_info@entry=0x7f44c7cc83e0, 
    alter_info=alter_info@entry=0x7f44c7cc8320) at /data/git/10.4_dbg/sql/sql_table.cc:5241
#13 0x0000561575b8c00d in Sql_cmd_create_table_like::execute (this=0x7f4481c6d170, thd=0x7f4481c15070)
    at /data/git/10.4_dbg/sql/sql_table.cc:11450
#14 0x0000561575acef29 in mysql_execute_command (thd=thd@entry=0x7f4481c15070)
    at /data/git/10.4_dbg/sql/sql_parse.cc:6101
#15 0x0000561575ad1848 in mysql_parse (thd=thd@entry=0x7f4481c15070, rawbuf=<optimized out>, 
    length=<optimized out>, parser_state=parser_state@entry=0x7f44c7cca8c0, 
    is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false)
    at /data/git/10.4_dbg/sql/sql_parse.cc:7900
#16 0x0000561575ad44ea in dispatch_command (command=command@entry=COM_QUERY, 
    thd=thd@entry=0x7f4481c15070, 
    packet=packet@entry=0x7f4481c57071 "CREATE TABLE t(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON)", packet_length=packet_length@entry=64, is_com_multi=is_com_multi@entry=false, 
    is_next_command=is_next_command@entry=false) at /data/git/10.4_dbg/sql/sql_parse.cc:1841
#17 0x0000561575ad847c in do_command (thd=0x7f4481c15070) at /data/git/10.4_dbg/sql/sql_parse.cc:1359
#18 0x0000561575c02d42 in do_handle_one_connection (connect=connect@entry=0x7f44c5435790)
    at /data/git/10.4_dbg/sql/sql_connect.cc:1412
#19 0x0000561575c02e62 in handle_one_connection (arg=0x7f44c5435790)
    at /data/git/10.4_dbg/sql/sql_connect.cc:1316
#20 0x00007f44c6e706db in start_thread (arg=0x7f44c7ccc700) at pthread_create.c:463
#21 0x00007f44c626e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

This secondary issue confirmed present in:
MariaDB: 10.4.13 (dbg), 10.5.2 (dbg)

This secondary issue confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

Comment by Roel Van de Paar [ 2020-04-24 ]

Additional testcase

USE test;
SET @@SESSION.collation_connection=utf32_bin;
CREATE TABLE t(c1 ENUM('a','b','ac') CHARACTER SET 'Binary',c2 JSON,c3 INT) ENGINE=InnoDB;

Leads to:

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

mysqld: /test/10.5_dbg/sql/table.cc:3131: int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t, const uchar*, size_t): Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed.

10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

Core was generated by `/test/MD210420-mariadb-10.5.3-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x7f36bcd09700 (LWP 2324979))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055685687b03d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
#2  0x0000556856020d7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f36bb44d801 in __GI_abort () at abort.c:79
#6  0x00007f36bb43d39a in __assert_fail_base (fmt=0x7f36bb5c47d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x556856a16930 "(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)", file=file@entry=0x556856a13f69 "/test/10.5_dbg/sql/table.cc", line=line@entry=3131, function=function@entry=0x556856a182c0 <TABLE_SHARE::init_from_binary_frm_image(THD*, bool, unsigned char const*, unsigned long, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t, const uchar*, size_t)") at assert.c:92
#7  0x00007f36bb43d412 in __GI___assert_fail (assertion=assertion@entry=0x556856a16930 "(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)", file=file@entry=0x556856a13f69 "/test/10.5_dbg/sql/table.cc", line=line@entry=3131, function=function@entry=0x556856a182c0 <TABLE_SHARE::init_from_binary_frm_image(THD*, bool, unsigned char const*, unsigned long, unsigned char const*, unsigned long)::__PRETTY_FUNCTION__> "int TABLE_SHARE::init_from_binary_frm_image(THD*, bool, const uchar*, size_t, const uchar*, size_t)") at assert.c:101
#8  0x0000556855e8e4ca in TABLE_SHARE::init_from_binary_frm_image (this=this@entry=0x7f36bcd06730, thd=thd@entry=0x7f368e815088, write=<optimized out>, frm_image=<optimized out>, frm_length=<optimized out>, par_image=par_image@entry=0x0, par_length=0) at /test/10.5_dbg/sql/table.cc:3129
#9  0x0000556856030377 in ha_create_table (thd=thd@entry=0x7f368e815088, path=path@entry=0x7f36bcd07530 "./test/t", db=0x7f368e8748e8 "test", table_name=0x7f368e8741e0 "t", create_info=create_info@entry=0x7f36bcd07980, frm=frm@entry=0x7f36bcd07520) at /test/10.5_dbg/sql/handler.cc:5332
#10 0x0000556855e47158 in create_table_impl (thd=thd@entry=0x7f368e815088, orig_db=..., orig_table_name=..., db=..., table_name=..., path=path@entry=0x7f36bcd07530 "./test/t", options=..., create_info=0x7f36bcd07980, alter_info=0x7f36bcd078b0, create_table_mode=0, is_trans=0x7f36bcd077b7, key_info=0x7f36bcd07518, key_count=0x7f36bcd07514, frm=0x7f36bcd07520) at /test/10.5_dbg/sql/sql_table.cc:5177
#11 0x0000556855e4763d in mysql_create_table_no_lock (thd=thd@entry=0x7f368e815088, db=db@entry=0x7f368e874230, table_name=table_name@entry=0x7f368e874240, create_info=create_info@entry=0x7f36bcd07980, alter_info=alter_info@entry=0x7f36bcd078b0, is_trans=is_trans@entry=0x7f36bcd077b7, create_table_mode=0, table_list=0x7f368e874218) at /test/10.5_dbg/sql/sql_table.cc:5261
#12 0x0000556855e47984 in mysql_create_table (thd=thd@entry=0x7f368e815088, create_table=create_table@entry=0x7f368e874218, create_info=create_info@entry=0x7f36bcd07980, alter_info=alter_info@entry=0x7f36bcd078b0) at /test/10.5_dbg/sql/sql_table.cc:5353
#13 0x0000556855e492e7 in Sql_cmd_create_table_like::execute (this=0x7f368e8741b8, thd=0x7f368e815088) at /test/10.5_dbg/sql/sql_table.cc:11879
#14 0x0000556855d7c422 in mysql_execute_command (thd=thd@entry=0x7f368e815088) at /test/10.5_dbg/sql/sql_parse.cc:5912
#15 0x0000556855d83f2b in mysql_parse (thd=thd@entry=0x7f368e815088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7f36bcd08450, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7957
#16 0x0000556855d6fc45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7f368e815088, packet=packet@entry=0x7f368e867089 "CREATE TABLE t(c1 ENUM('a','b','ac') CHARACTER SET 'Binary',c2 JSON,c3 INT) ENGINE=InnoDB", packet_length=packet_length@entry=89, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1839
#17 0x0000556855d6e49b in do_command (thd=0x7f368e815088) at /test/10.5_dbg/sql/sql_parse.cc:1358
#18 0x0000556855ec9415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7f369afc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
#19 0x0000556855ec9744 in handle_one_connection (arg=arg@entry=0x7f369afc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
#20 0x0000556856329fb0 in pfs_spawn_thread (arg=0x7f36ba845b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
#21 0x00007f36bc1306db in start_thread (arg=0x7f36bcd09700) at pthread_create.c:463
#22 0x00007f36bb52e88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (dbg), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

Comment by Alexander Barkov [ 2020-05-20 ]

The same crash happens starting with 10.2 with the following scripts:

SET NAMES latin1;
CREATE OR REPLACE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary', d JSON);

SET NAMES latin1;
CREATE OR REPLACE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary', d INT DEFAULT NULL CHECK (d>0));

SET NAMES latin1;
CREATE OR REPLACE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary' CHECK (c>0));

Comment by Alexander Barkov [ 2020-05-20 ]

In 10.1 it does not crash, but a wrong behaviour is still reproducible:

CREATE OR REPLACE TABLE t1(c ENUM(0x6100) CHARACTER SET 'Binary');
SHOW CREATE TABLE t1;

+-------+-----------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                              |
+-------+-----------------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `c` enum() CHARACTER SET binary DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------------------------------------------+

Notice, the ENUM definition has an empty value list.

Now if I insert a value into the table, it returns a warning:

INSERT INTO t1 VALUES (1);
SHOW WARNINGS;

+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1265 | Data truncated for column 'c' at row 1 |
+---------+------+----------------------------------------+

Looks wrong. It should insert the first ENUM value, which is 0x6100.

Comment by Roel Van de Paar [ 2020-05-27 ]

Filter removed from runs

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