mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob
when auto-adding a virtual LONG_UNIQUE_HASH_FIELD, fill in a Virtual_column_info for it, so that fill_alter_inplace_info() would know we're adding a virtual field (ALTER_ADD_VIRTUAL_COLUMN).
This commit is contained in:
@ -10,3 +10,13 @@ create temporary table tmp (a varchar(1024), b int, c int, d int, e linestring,
|
||||
load data infile 'load.data' into table tmp;
|
||||
delete from tmp;
|
||||
drop table t1;
|
||||
create table t1 (b blob) engine=innodb;
|
||||
alter table t1 add unique (b);
|
||||
alter table t1 force;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`b` blob DEFAULT NULL,
|
||||
UNIQUE KEY `b` (`b`) USING HASH
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
@ -1,3 +1,5 @@
|
||||
--source include/have_innodb.inc
|
||||
|
||||
#
|
||||
# MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list
|
||||
#
|
||||
@ -15,3 +17,12 @@ delete from tmp;
|
||||
drop table t1;
|
||||
--let $datadir= `SELECT @@datadir`
|
||||
--remove_file $datadir/test/load.data
|
||||
|
||||
#
|
||||
# MDEV-18712 InnoDB indexes are inconsistent with what defined in .frm for table after rebuilding table with index on blob
|
||||
#
|
||||
create table t1 (b blob) engine=innodb;
|
||||
alter table t1 add unique (b);
|
||||
alter table t1 force;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
@ -3321,6 +3321,8 @@ static Create_field * add_hash_field(THD * thd, List<Create_field> *create_list,
|
||||
cf->length= cf->char_length= cf->pack_length= HA_HASH_FIELD_LENGTH;
|
||||
cf->invisible= INVISIBLE_FULL;
|
||||
cf->pack_flag|= FIELDFLAG_MAYBE_NULL;
|
||||
cf->vcol_info= new (thd->mem_root) Virtual_column_info();
|
||||
cf->vcol_info->stored_in_db= false;
|
||||
uint num= 1;
|
||||
LEX_CSTRING field_name;
|
||||
field_name.str= (char *)thd->alloc(LONG_HASH_FIELD_NAME_LENGTH);
|
||||
|
@ -691,7 +691,7 @@ static bool pack_vcols(String *buf, List<Create_field> &create_fields,
|
||||
|
||||
for (uint field_nr=0; (field= it++); field_nr++)
|
||||
{
|
||||
if (field->vcol_info)
|
||||
if (field->vcol_info && field->vcol_info->expr)
|
||||
if (pack_expression(buf, field->vcol_info, field_nr,
|
||||
field->vcol_info->stored_in_db
|
||||
? VCOL_GENERATED_STORED : VCOL_GENERATED_VIRTUAL))
|
||||
|
Reference in New Issue
Block a user