[MDEV-16110] ALTER with ALGORITHM=INPLACE breaks temporary table with virtual columns Created: 2018-05-07  Updated: 2022-12-01  Resolved: 2018-12-20

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Data Definition - Temporary, Virtual Columns
Affects Version/s: 10.2, 10.3
Fix Version/s: 10.2.20, 10.3.12

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
PartOf
includes MDEV-16176 ER_INVALID_CHARACTER_STRING and Incor... Closed
Relates
relates to MDEV-30112 ASAN errors in Item_ident::print / ge... Closed

 Description   

CREATE TEMPORARY TABLE t (a INT, v INT AS (a));
--error ER_ALTER_OPERATION_NOT_SUPPORTED
ALTER TABLE t CHANGE COLUMN a b INT, ALGORITHM=INPLACE;
SHOW CREATE TABLE t;

10.3 a22a339f8e04

MariaDB [test]> ALTER TABLE t CHANGE COLUMN a b INT, ALGORITHM=INPLACE;
ERROR 1845 (0A000): ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
MariaDB [test]> SHOW CREATE TABLE t;
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                    |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TEMPORARY TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `v` int(11) GENERATED ALWAYS AS (`?`) VIRTUAL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Result can vary on different builds. For example, on 10.2.13 it looks like this for me:

SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TEMPORARY TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `v` int(11) GENERATED ALWAYS AS (`b`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

That is, the virtual column expression has been changed, even although ALTER failed.

Or,

10.2 e44ca6cc9

ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
SHOW CREATE TABLE t;
Table	Create Table
t	CREATE TEMPORARY TABLE `t` (
  `a` int(11) DEFAULT NULL,
  `v` int(11) GENERATED ALWAYS AS (`????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????h4z`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1

ASAN only complains on SHOW TABLE:

==26140==ERROR: AddressSanitizer: use-after-poison on address 0x62b0000009c0 at pc 0x55d1c05dd2d7 bp 0x7f68dddface0 sp 0x7f68dddfacd8
READ of size 1 at 0x62b0000009c0 thread T5
    #0 0x55d1c05dd2d6 in Item_ident::print(String*, enum_query_type) /data/src/10.2/sql/item.cc:2724
    #1 0x55d1c05ff735 in Item_field::print(String*, enum_query_type) /data/src/10.2/sql/item.cc:7390
    #2 0x55d1c05ccccc in Item::print_parenthesised(String*, enum_query_type, precedence) /data/src/10.2/sql/item.cc:582
    #3 0x55d1c0173cc3 in Item::print_for_table_def(String*) /data/src/10.2/sql/item.h:1312
    #4 0x55d1c0174525 in Virtual_column_info::print(String*) /data/src/10.2/sql/item.h:6039
    #5 0x55d1c0128ef5 in show_create_table(THD*, TABLE_LIST*, String*, Table_specification_st*, enum_with_db_name) /data/src/10.2/sql/sql_show.cc:1985
    #6 0x55d1c0123eb5 in mysqld_show_create_get_fields(THD*, TABLE_LIST*, List<Item>*, String*) /data/src/10.2/sql/sql_show.cc:1251
    #7 0x55d1c0124655 in mysqld_show_create(THD*, TABLE_LIST*) /data/src/10.2/sql/sql_show.cc:1324
    #8 0x55d1bffbf48b in mysql_execute_command(THD*) /data/src/10.2/sql/sql_parse.cc:4241
    #9 0x55d1bffd73a0 in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /data/src/10.2/sql/sql_parse.cc:7924
    #10 0x55d1bffb2577 in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /data/src/10.2/sql/sql_parse.cc:1820
    #11 0x55d1bffaf61b in do_command(THD*) /data/src/10.2/sql/sql_parse.cc:1374
    #12 0x55d1c02eb6c3 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1335
    #13 0x55d1c02eb0d8 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #14 0x55d1c0cf8343 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1862
    #15 0x7f68ea281493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
    #16 0x7f68e866793e in __clone (/lib/x86_64-linux-gnu/libc.so.6+0xe893e)
 
0x62b0000009c0 is located 1984 bytes inside of 24716-byte region [0x62b000000200,0x62b00000628c)
allocated by thread T5 here:
    #0 0x7f68ea4eb73f in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x5473f)
    #1 0x55d1c1618193 in sf_malloc /data/src/10.2/mysys/safemalloc.c:118
    #2 0x55d1c15e73fc in my_malloc /data/src/10.2/mysys/my_malloc.c:101
    #3 0x55d1c15c7a4f in reset_root_defaults /data/src/10.2/mysys/my_alloc.c:146
    #4 0x55d1bff06109 in THD::init_for_queries() /data/src/10.2/sql/sql_class.cc:1404
    #5 0x55d1c02eaa95 in prepare_new_connection_state(THD*) /data/src/10.2/sql/sql_connect.cc:1172
    #6 0x55d1c02eb11e in thd_prepare_connection(THD*) /data/src/10.2/sql/sql_connect.cc:1256
    #7 0x55d1c02eb699 in do_handle_one_connection(CONNECT*) /data/src/10.2/sql/sql_connect.cc:1326
    #8 0x55d1c02eb0d8 in handle_one_connection /data/src/10.2/sql/sql_connect.cc:1241
    #9 0x55d1c0cf8343 in pfs_spawn_thread /data/src/10.2/storage/perfschema/pfs.cc:1862
    #10 0x7f68ea281493 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x7493)
 
Thread T5 created by T0 here:
    #0 0x7f68ea4babba in pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.1+0x23bba)
    #1 0x55d1c0cf890b in spawn_thread_v1 /data/src/10.2/storage/perfschema/pfs.cc:1912
    #2 0x55d1bfdacbfe in inline_mysql_thread_create /data/src/10.2/include/mysql/psi/mysql_thread.h:1239
    #3 0x55d1bfdc1adb in create_thread_to_handle_connection(CONNECT*) /data/src/10.2/sql/mysqld.cc:6450
    #4 0x55d1bfdc21e0 in create_new_thread /data/src/10.2/sql/mysqld.cc:6520
    #5 0x55d1bfdc31f1 in handle_connections_sockets() /data/src/10.2/sql/mysqld.cc:6795
    #6 0x55d1bfdc1030 in mysqld_main(int, char**) /data/src/10.2/sql/mysqld.cc:6069
    #7 0x55d1bfdaaf9f in main /data/src/10.2/sql/main.cc:25
    #8 0x7f68e859f2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
 
SUMMARY: AddressSanitizer: use-after-poison /data/src/10.2/sql/item.cc:2724 Item_ident::print(String*, enum_query_type)
Shadow bytes around the buggy address:
  0x0c567fff80e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c567fff80f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c567fff8100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c567fff8110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c567fff8120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7
=>0x0c567fff8130: f7 f7 f7 f7 f7 f7 f7 f7[f7]f7 f7 f7 f7 f7 f7 f7
  0x0c567fff8140: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c567fff8150: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c567fff8160: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c567fff8170: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x0c567fff8180: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==26140==ABORTING
----------SERVER LOG END-------------

However, it's not a glitch of SHOW TABLE, other attempts to work with the table confirm it's really broken, e.g.

CREATE TEMPORARY TABLE t (a INT, v INT AS (a));
ALTER TABLE t CHANGE COLUMN a b INT, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
ALTER TABLE t FORCE;
bug.t2e                                  [ fail ]
        Test ended at 2018-05-07 23:00:33
 
CURRENT_TEST: bug.t2e
mysqltest: At line 5: query 'ALTER TABLE t FORCE' failed: 1054: Unknown column '
                                                                                ' in 'GENERATED ALWAYS AS'



 Comments   
Comment by Sergei Golubchik [ 2018-05-15 ]

Pushed the fix for non-temporary tables into 10.2.15 and 10.3.7.

For temporary tables TABLE::m_need_reopen does not work. We need to support it for temporary tables. Options:

  • if TABLE_SHARE is ok and only the TABLE is corrupted, open_table_from_share() will do.
  • if TABLE_SHARE is bad too, saving/restoring TABLE_SHARE::mem_root might be an option
  • if not, saving frm image in TABLE_SHARE::frm_image and reopening it would be a true reopen, like for non-temp tables.
Comment by Alice Sherepa [ 2018-11-12 ]

on 10.4 3ea7de9a78a1410a9b79

#0 0x562a2850835a in append_identifier(THD*, String*, char const*, unsigned long) /git/10.4/sql/sql_show.cc:1642
#1 0x562a28aad21a in append_identifier /git/10.4/sql/sql_show.h:88
#2 0x562a28ac5bc0 in Item_ident::print(String*, enum_query_type) /git/10.4/sql/item.cc:3112
#3 0x562a28ae6e51 in Item_field::print(String*, enum_query_type) /git/10.4/sql/item.cc:7516
#4 0x562a28aafe14 in Item::print_parenthesised(String*, enum_query_type, precedence) /git/10.4/sql/item.cc:412
#5 0x562a28555651 in Item::print_for_table_def(String*) /git/10.4/sql/item.h:1580
#6 0x562a28555e89 in Virtual_column_info::print(String*) /git/10.4/sql/item.h:6889
#7 0x562a28675435 in pack_expression /git/10.4/sql/unireg.cc:639
#8 0x562a286756af in pack_vcols /git/10.4/sql/unireg.cc:660
#9 0x562a28671cd6 in build_frm_image(THD*, st_mysql_const_lex_string const*, HA_CREATE_INFO*, List<Create_field>&, unsigned int, st_key*, handler*) /git/10.4/sql/unireg.cc:194
#10 0x562a28593aaf in 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*) /git/10.4/sql/sql_table.cc:4707
#11 0x562a28594ee9 in create_table_impl /git/10.4/sql/sql_table.cc:4948
#12 0x562a285b0ae7 in 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) /git/10.4/sql/sql_table.cc:9572
#13 0x562a286efe63 in Sql_cmd_alter_table::execute(THD*) /git/10.4/sql/sql_alter.cc:497
#14 0x562a283a9bdf in mysql_execute_command(THD*) /git/10.4/sql/sql_parse.cc:6289
#15 0x562a283b43ee in mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool) /git/10.4/sql/sql_parse.cc:8091
#16 0x562a2838f2eb in dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool) /git/10.4/sql/sql_parse.cc:1851
#17 0x562a2838c483 in do_command(THD*) /git/10.4/sql/sql_parse.cc:1396
#18 0x562a286e12f4 in do_handle_one_connection(CONNECT*) /git/10.4/sql/sql_connect.cc:1402
#19 0x562a286e0cd1 in handle_one_connection /git/10.4/sql/sql_connect.cc:1308
#20 0x7f1e0580b6b9 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x76b9)
#21 0x7f1e04ca041c in clone (/lib/x86_64-linux-gnu/libc.so.6+0x10741c)

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