[MDEV-19336] Assertion `expr == default_value->expr' failed in make_empty_rec_store_default / ERROR 1901 (on optimized builds) Created: 2019-04-25  Updated: 2023-10-10  Resolved: 2023-10-10

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table
Affects Version/s: 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Alice Sherepa Assignee: Unassigned
Resolution: Cannot Reproduce Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-18163 Assertion `table_share->tmp_table != ... Closed

 Description   

CREATE TABLE t1 ( c1 varchar(1) DEFAULT '4' );
ALTER TABLE t1 ALTER COLUMN c1 SET DEFAULT (SELECT 4);

10.4 ca7fbcea6c4fe13c295cf43

mysqld: /10.4/sql/unireg.cc:987: bool make_empty_rec_store_default(THD*, Field*, Virtual_column_info*): Assertion `expr == default_value->expr' failed.
190425 15:19:27 [ERROR] mysqld got signal 6 ;
 
linux/raise.c:54(__GI_raise)[0x7fd9646a1428]
stdlib/abort.c:91(__GI_abort)[0x7fd9646a302a]
assert/assert.c:92(__assert_fail_base)[0x7fd964699bd7]
/lib/x86_64-linux-gnu/libc.so.6(+0x2dc82)[0x7fd964699c82]
sql/unireg.cc:988(make_empty_rec_store_default(THD*, Field*, Virtual_column_info*))[0x55cf13d13ad4]
sql/unireg.cc:1063(make_empty_rec(THD*, unsigned char*, unsigned int, List<Create_field>&, unsigned int, unsigned long))[0x55cf13d1443c]
sql/unireg.cc:428(build_frm_image(THD*, st_mysql_const_lex_string const&, HA_CREATE_INFO*, List<Create_field>&, unsigned int, st_key*, handler*))[0x55cf13d0e637]
sql/sql_table.cc:4791(mysql_create_frm_image(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, HA_CREATE_INFO*, Alter_info*, int, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*))[0x55cf13c24bd2]
sql/sql_table.cc:5026(create_table_impl(THD*, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, st_mysql_const_lex_string const&, char const*, DDL_options_st, HA_CREATE_INFO*, Alter_info*, int, bool*, st_key**, unsigned int*, st_mysql_const_unsigned_lex_string*))[0x55cf13c25fba]
sql/sql_table.cc:9845(mysql_alter_table(THD*, st_mysql_const_lex_string const*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, TABLE_LIST*, Alter_info*, unsigned int, st_order*, bool))[0x55cf13c43650]
sql/sql_alter.cc:496(Sql_cmd_alter_table::execute(THD*))[0x55cf13d93761]
sql/sql_parse.cc:6344(mysql_execute_command(THD*))[0x55cf13a2ad7a]
sql/sql_parse.cc:8154(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55cf13a353d4]
sql/sql_parse.cc:1834(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55cf13a0e084]
sql/sql_parse.cc:1365(do_command(THD*))[0x55cf13a0afc3]
sql/sql_connect.cc:1398(do_handle_one_connection(CONNECT*))[0x55cf13d7e915]
sql/sql_connect.cc:1302(handle_one_connection)[0x55cf13d7e2df]
perfschema/pfs.cc:1864(pfs_spawn_thread)[0x55cf1511b827]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fd9654e26ba]
x86_64/clone.S:111(clone)[0x7fd96477341d]
 
Query (0x62b00007e288): ALTER TABLE t1 ALTER COLUMN c1 SET DEFAULT (SELECT 4)



 Comments   
Comment by Alice Sherepa [ 2019-04-25 ]

10.4/sql/sql_select.cc:19362: void free_tmp_table(THD*, TABLE*): Assertion `entry->pos_in_table_list->table == entry' failed.

CREATE TABLE t1 ( c1 varchar(1) DEFAULT '4' );
ALTER TABLE t1 ALTER COLUMN c1 SET DEFAULT (values(4));

10.4 ca7fbcea6c4fe13c295cf43

    #0 0x557c288c5750 in free_tmp_table(THD*, TABLE*) /10.4/sql/sql_select.cc:19360
    #1 0x557c2864079d in close_thread_tables(THD*) /10.4/sql/sql_base.cc:892
    #2 0x557c287be451 in mysql_execute_command(THD*) /10.4/sql/sql_parse.cc:6410
    #3 0x557c287c83d3 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /10.4/sql/sql_parse.cc:8154
    #4 0x557c287a1083 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /10.4/sql/sql_parse.cc:1832
    #5 0x557c2879dfc2 in do_command(THD*) /10.4/sql/sql_parse.cc:1365
    #6 0x557c28b11914 in do_handle_one_connection(CONNECT*) /10.4/sql/sql_connect.cc:1398
    #7 0x557c28b112de in handle_one_connection /10.4/sql/sql_connect.cc:1301
    #8 0x557c29eae826 in pfs_spawn_thread /10.4/storage/perfschema/pfs.cc:1862
    #9 0x7fe5641986b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
    #10 0x7fe56342941c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)

Comment by Roel Van de Paar [ 2020-07-14 ]

10.5.5 e1013725ce0f3f947e728491eef75d9985e8db2f

10.5.5>CREATE TABLE t1 ( c1 varchar(1) DEFAULT '4' );
Query OK, 0 rows affected (0.011 sec)
10.5.5>ALTER TABLE t1 ALTER COLUMN c1 SET DEFAULT (values(4));
ERROR 1901 (HY000): Function or expression 'select ...' cannot be used in the DEFAULT clause of `c1`

Comment by Roel Van de Paar [ 2020-07-14 ]

Ref here for all unique bugid's in this area.

Comment by Alice Sherepa [ 2023-10-10 ]

not reproducible on current 10.4 0c7af6a2a19343cb9d4fedbd7165b8f73bc4cf96 -11.2

Generated at Thu Feb 08 08:50:53 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.