MDEV-22775: Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2021-04-08 08:08:53 +03:00
commit 2a7810759d
15 changed files with 340 additions and 123 deletions

View File

@ -2032,3 +2032,14 @@ ALTER TABLE t1 MODIFY a VARCHAR(2)
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
INSERT INTO t1 VALUES ('a');
DROP TABLE t1;
#
# MDEV-22775 [HY000][1553] Changing name of primary key column with foreign key constraint fails.
#
create table t1 (id int primary key) engine=innodb default charset=utf8;
create table t2 (input_id int primary key, id int not null,
key a (id),
constraint a foreign key (id) references t1 (id)
)engine=innodb default charset=utf8;
alter table t1 change id id2 int;
drop table t2;
drop table t1;

View File

@ -843,3 +843,17 @@ ALTER TABLE t1 MODIFY a VARCHAR(2)
CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
INSERT INTO t1 VALUES ('a');
DROP TABLE t1;
--echo #
--echo # MDEV-22775 [HY000][1553] Changing name of primary key column with foreign key constraint fails.
--echo #
create table t1 (id int primary key) engine=innodb default charset=utf8;
create table t2 (input_id int primary key, id int not null,
key a (id),
constraint a foreign key (id) references t1 (id)
)engine=innodb default charset=utf8;
alter table t1 change id id2 int;
drop table t2;
drop table t1;

View File

@ -458,19 +458,21 @@ public:
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const override
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override
{
def->create_length_to_internal_length_simple();
def->prepare_stage1_simple(&my_charset_numeric);
return false;
}
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->set_compression_method(dup->compression_method());
def->create_length_to_internal_length_string();
return false;

View File

@ -10828,16 +10828,26 @@ Column_definition::Column_definition(THD *thd, Field *old_field,
CREATE TABLE t1 (a INT) AS SELECT a FROM t2;
See Type_handler::Column_definition_redefine_stage1()
for data type specific code.
@param this - The field definition corresponding to the expression
in the "AS SELECT.." part.
@param dup_field - The field definition from the "CREATE TABLE (...)" part.
It has already underwent prepare_stage1(), so
must be fully initialized:
-- dup_field->charset is set and BINARY
sorting style is applied, see find_bin_collation().
@param file - The table handler
*/
void
Column_definition::redefine_stage1_common(const Column_definition *dup_field,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
{
set_handler(dup_field->type_handler());
default_value= dup_field->default_value;
charset= dup_field->charset ? dup_field->charset :
schema->default_table_charset;
DBUG_ASSERT(dup_field->charset); // Set by prepare_stage1()
charset= dup_field->charset;
length= dup_field->char_length;
pack_length= dup_field->pack_length;
decimals= dup_field->decimals;

View File

@ -5131,6 +5131,11 @@ public:
bool frm_unpack_temporal_with_dec(TABLE_SHARE *share, uint intlen,
const uchar *buff);
void set_length_and_dec(const Lex_length_and_dec_st &attr);
CHARSET_INFO *explicit_or_derived_charset(const Column_derived_attributes
*derived_attr) const
{
return charset ? charset : derived_attr->charset();
}
};
@ -5266,6 +5271,15 @@ public:
void create_length_to_internal_length_bit();
void create_length_to_internal_length_newdecimal();
/*
Prepare the "charset" member for string data types,
such as CHAR, VARCHAR, TEXT, ENUM, SET:
- derive the charset if not specified explicitly
- find a _bin collation if the BINARY comparison style was specified, e.g.:
CREATE TABLE t1 (a VARCHAR(10) BINARY) CHARSET utf8;
*/
bool prepare_charset_for_string(const Column_derived_attributes *dattr);
/**
Prepare a SET/ENUM field.
Create "interval" from "interval_list" if needed, and adjust "length".
@ -5301,7 +5315,13 @@ public:
bool sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root);
bool prepare_stage1(THD *thd, MEM_ROOT *mem_root,
handler *file, ulonglong table_flags);
handler *file, ulonglong table_flags,
const Column_derived_attributes *derived_attr);
void prepare_stage1_simple(CHARSET_INFO *cs)
{
charset= cs;
create_length_to_internal_length_simple();
}
bool prepare_stage1_typelib(THD *thd, MEM_ROOT *mem_root,
handler *file, ulonglong table_flags);
bool prepare_stage1_string(THD *thd, MEM_ROOT *mem_root,
@ -5309,15 +5329,19 @@ public:
bool prepare_stage1_bit(THD *thd, MEM_ROOT *mem_root,
handler *file, ulonglong table_flags);
bool bulk_alter(const Column_derived_attributes *derived_attr,
const Column_bulk_alter_attributes *bulk_attr)
{
return type_handler()->Column_definition_bulk_alter(this,
derived_attr,
bulk_attr);
}
void redefine_stage1_common(const Column_definition *dup_field,
const handler *file,
const Schema_specification_st *schema);
bool redefine_stage1(const Column_definition *dup_field, const handler *file,
const Schema_specification_st *schema)
const handler *file);
bool redefine_stage1(const Column_definition *dup_field, const handler *file)
{
const Type_handler *handler= dup_field->type_handler();
return handler->Column_definition_redefine_stage1(this, dup_field,
file, schema);
return handler->Column_definition_redefine_stage1(this, dup_field, file);
}
bool prepare_stage2(handler *handler, ulonglong table_flags);
bool prepare_stage2_blob(handler *handler,

View File

@ -2167,7 +2167,7 @@ public:
struct Table_scope_and_contents_source_pod_st // For trivial members
{
CHARSET_INFO *table_charset;
CHARSET_INFO *alter_table_convert_to_charset;
LEX_CUSTRING tabledef_version;
LEX_CSTRING connect_string;
LEX_CSTRING comment;
@ -2316,7 +2316,7 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st,
DBUG_ASSERT(cs);
if (check_conflicting_charset_declarations(cs))
return true;
table_charset= default_table_charset= cs;
alter_table_convert_to_charset= default_table_charset= cs;
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
return false;
}

View File

@ -2313,6 +2313,8 @@ static int add_column_list_values(String *str, partition_info *part_info,
*/
if (create_info)
{
const Column_derived_attributes
derived_attr(create_info->default_table_charset);
Create_field *sql_field;
if (!(sql_field= get_sql_field(field_name,
@ -2324,7 +2326,7 @@ static int add_column_list_values(String *str, partition_info *part_info,
th= sql_field->type_handler();
if (th->partition_field_check(sql_field->field_name, item_expr))
return 1;
field_cs= get_sql_field_charset(sql_field, create_info);
field_cs= sql_field->explicit_or_derived_charset(&derived_attr);
}
else
{

View File

@ -3043,6 +3043,15 @@ bool check_duplicates_in_interval(const char *set_or_name,
}
bool Column_definition::
prepare_charset_for_string(const Column_derived_attributes *dattr)
{
if (!charset)
charset= dattr->charset();
return (flags & BINCMP_FLAG) && !(charset= find_bin_collation(charset));
}
bool Column_definition::prepare_stage2_blob(handler *file,
ulonglong table_flags,
uint field_flags)
@ -3123,38 +3132,6 @@ bool Column_definition::prepare_stage2(handler *file,
}
/*
Get character set from field object generated by parser using
default values when not set.
SYNOPSIS
get_sql_field_charset()
sql_field The sql_field object
create_info Info generated by parser
RETURN VALUES
cs Character set
*/
CHARSET_INFO* get_sql_field_charset(Column_definition *sql_field,
HA_CREATE_INFO *create_info)
{
CHARSET_INFO *cs= sql_field->charset;
if (!cs)
cs= create_info->default_table_charset;
/*
table_charset is set only in ALTER TABLE t1 CONVERT TO CHARACTER SET csname
if we want change character set for all varchar/char columns.
But the table charset must not affect the BLOB fields, so don't
allow to change my_charset_bin to somethig else.
*/
if (create_info->table_charset && cs != &my_charset_bin)
cs= create_info->table_charset;
return cs;
}
/**
Modifies the first column definition whose SQL type is TIMESTAMP
by adding the features DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.
@ -3327,11 +3304,14 @@ bool Column_definition::prepare_stage1_bit(THD *thd,
bool Column_definition::prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
handler *file,
ulonglong table_flags)
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
{
return type_handler()->Column_definition_prepare_stage1(thd, mem_root,
this, file,
table_flags);
table_flags,
derived_attr);
}
@ -3598,6 +3578,9 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
int select_field_count= C_CREATE_SELECT(create_table_mode);
bool tmp_table= create_table_mode == C_ALTER_TABLE;
bool is_hash_field_needed= false;
const Column_derived_attributes dattr(create_info->default_table_charset);
const Column_bulk_alter_attributes
battr(create_info->alter_table_convert_to_charset);
DBUG_ENTER("mysql_prepare_create_table");
DBUG_EXECUTE_IF("test_pseudo_invisible",{
@ -3653,26 +3636,27 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
for (field_no=0; (sql_field=it++) ; field_no++)
{
/* Virtual fields are always NULL */
if (sql_field->vcol_info)
sql_field->flags&= ~NOT_NULL_FLAG;
/*
Initialize length from its original value (number of characters),
which was set in the parser. This is necessary if we're
executing a prepared statement for the second time.
*/
sql_field->length= sql_field->char_length;
/* Set field charset. */
sql_field->charset= get_sql_field_charset(sql_field, create_info);
if ((sql_field->flags & BINCMP_FLAG) &&
!(sql_field->charset= find_bin_collation(sql_field->charset)))
DBUG_RETURN(true);
/* Virtual fields are always NULL */
if (sql_field->vcol_info)
sql_field->flags&= ~NOT_NULL_FLAG;
if (sql_field->bulk_alter(&dattr, &battr))
DBUG_RETURN(true);
if (sql_field->prepare_stage1(thd, thd->mem_root,
file, file->ha_table_flags()))
file, file->ha_table_flags(),
&dattr))
DBUG_RETURN(true);
DBUG_ASSERT(sql_field->charset);
if (sql_field->real_field_type() == MYSQL_TYPE_BIT &&
file->ha_table_flags() & HA_CAN_BIT_FIELD)
total_uneven_bit_length+= sql_field->length & 7;
@ -3723,7 +3707,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields--;
if (sql_field->redefine_stage1(dup_field, file, create_info))
if (sql_field->redefine_stage1(dup_field, file))
DBUG_RETURN(true);
it2.remove(); // Remove first (create) definition
@ -4764,7 +4748,9 @@ bool Column_definition::prepare_blob_field(THD *thd)
bool Column_definition::sp_prepare_create_field(THD *thd, MEM_ROOT *mem_root)
{
return prepare_stage1(thd, mem_root, NULL, HA_CAN_GEOMETRY) ||
DBUG_ASSERT(charset);
const Column_derived_attributes dattr(&my_charset_bin);
return prepare_stage1(thd, mem_root, NULL, HA_CAN_GEOMETRY, &dattr) ||
prepare_stage2(NULL, HA_CAN_GEOMETRY);
}
@ -11946,8 +11932,8 @@ bool Sql_cmd_create_table_like::execute(THD *thd)
{
create_info.used_fields&= ~HA_CREATE_USED_CHARSET;
create_info.used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
create_info.default_table_charset= create_info.table_charset;
create_info.table_charset= 0;
create_info.default_table_charset= create_info.alter_table_convert_to_charset;
create_info.alter_table_convert_to_charset= 0;
}
/*

View File

@ -258,8 +258,6 @@ bool quick_rm_table(THD *thd, handlerton *base, const LEX_CSTRING *db,
const char *table_path=0);
void close_cached_table(THD *thd, TABLE *table);
void sp_prepare_create_field(THD *thd, Column_definition *sql_field);
CHARSET_INFO* get_sql_field_charset(Column_definition *sql_field,
HA_CREATE_INFO *create_info);
bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags);
int write_bin_log(THD *thd, bool clear_error,
char const *query, ulong query_length,

View File

@ -2988,9 +2988,12 @@ bool Type_handler::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->create_length_to_internal_length_simple();
def->prepare_stage1_simple(&my_charset_bin);
return false;
}
@ -2999,8 +3002,12 @@ bool Type_handler_null::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->prepare_charset_for_string(derived_attr);
def->create_length_to_internal_length_null();
return false;
}
@ -3010,19 +3017,56 @@ bool Type_handler_row::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->charset= &my_charset_bin;
def->create_length_to_internal_length_null();
return false;
}
bool Type_handler_temporal_result::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->prepare_stage1_simple(&my_charset_numeric);
return false;
}
bool Type_handler_numeric::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->prepare_stage1_simple(&my_charset_numeric);
return false;
}
bool Type_handler_newdecimal::
Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->charset= &my_charset_numeric;
def->create_length_to_internal_length_newdecimal();
return false;
}
@ -3032,8 +3076,12 @@ bool Type_handler_bit::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
def->charset= &my_charset_numeric;
return def->prepare_stage1_bit(thd, mem_root, file, table_flags);
}
@ -3042,9 +3090,13 @@ bool Type_handler_typelib::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
return def->prepare_stage1_typelib(thd, mem_root, file, table_flags);
return def->prepare_charset_for_string(derived_attr) ||
def->prepare_stage1_typelib(thd, mem_root, file, table_flags);
}
@ -3053,22 +3105,50 @@ bool Type_handler_string_result::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const
{
return def->prepare_stage1_string(thd, mem_root, file, table_flags);
return def->prepare_charset_for_string(derived_attr) ||
def->prepare_stage1_string(thd, mem_root, file, table_flags);
}
/*************************************************************************/
bool Type_handler_general_purpose_string::
Column_definition_bulk_alter(Column_definition *def,
const Column_derived_attributes
*derived_attr,
const Column_bulk_alter_attributes
*bulk_alter_attr)
const
{
if (!bulk_alter_attr->alter_table_convert_to_charset())
return false; // No "CONVERT TO" clause.
CHARSET_INFO *defcs= def->explicit_or_derived_charset(derived_attr);
DBUG_ASSERT(defcs);
/*
Handle 'ALTER TABLE t1 CONVERT TO CHARACTER SET csname'.
Change character sets for all varchar/char/text columns,
but do not touch varbinary/binary/blob columns.
*/
if (defcs != &my_charset_bin)
def->charset= bulk_alter_attr->alter_table_convert_to_charset();
return false;
};
/*************************************************************************/
bool Type_handler::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->create_length_to_internal_length_simple();
return false;
}
@ -3077,11 +3157,10 @@ bool Type_handler::
bool Type_handler_null::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->create_length_to_internal_length_null();
return false;
}
@ -3090,11 +3169,10 @@ bool Type_handler_null::
bool Type_handler_newdecimal::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->create_length_to_internal_length_newdecimal();
return false;
}
@ -3103,11 +3181,10 @@ bool Type_handler_newdecimal::
bool Type_handler_string_result::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->set_compression_method(dup->compression_method());
def->create_length_to_internal_length_string();
return false;
@ -3117,11 +3194,10 @@ bool Type_handler_string_result::
bool Type_handler_typelib::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
def->create_length_to_internal_length_typelib();
return false;
}
@ -3130,11 +3206,10 @@ bool Type_handler_typelib::
bool Type_handler_bit::
Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const
{
def->redefine_stage1_common(dup, file, schema);
def->redefine_stage1_common(dup, file);
/*
If we are replacing a field with a BIT field, we need
to initialize pack_flag.

View File

@ -84,7 +84,6 @@ class Spvar_definition;
struct st_value;
class Protocol;
class handler;
struct Schema_specification_st;
struct TABLE;
struct SORT_FIELD_ATTR;
struct SORT_FIELD;
@ -250,6 +249,53 @@ public:
};
/*
A helper class to store column attributes that are inherited
by columns (from the table level) when not specified explicitly.
*/
class Column_derived_attributes
{
/*
Table level CHARACTER SET and COLLATE value:
CREATE TABLE t1 (a VARCHAR(1), b CHAR(2)) CHARACTER SET latin1;
All character string columns (CHAR, VARCHAR, TEXT)
inherit CHARACTER SET from the table level.
*/
CHARSET_INFO *m_charset;
public:
explicit Column_derived_attributes(CHARSET_INFO *cs)
:m_charset(cs)
{ }
CHARSET_INFO *charset() const { return m_charset; }
};
/*
A helper class to store requests for changes
in multiple column data types during ALTER.
*/
class Column_bulk_alter_attributes
{
/*
Target CHARACTER SET specification in ALTER .. CONVERT, e.g.
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
All character string columns (CHAR, VARCHAR, TEXT)
get converted to the "CONVERT TO CHARACTER SET".
*/
CHARSET_INFO *m_alter_table_convert_to_charset;
public:
explicit Column_bulk_alter_attributes(CHARSET_INFO *convert)
:m_alter_table_convert_to_charset(convert)
{ }
CHARSET_INFO *alter_table_convert_to_charset() const
{ return m_alter_table_convert_to_charset; }
};
class Native: public Binary_string
{
public:
@ -3883,7 +3929,17 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const;
virtual bool Column_definition_bulk_alter(Column_definition *c,
const Column_derived_attributes
*derived_attr,
const Column_bulk_alter_attributes
*bulk_alter_attr)
const
{ return false; }
/*
This method is called on queries like:
CREATE TABLE t2 (a INT) AS SELECT a FROM t1;
@ -3902,9 +3958,7 @@ public:
*/
virtual bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *
schema)
const handler *file)
const;
virtual bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
@ -4357,11 +4411,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override
{
DBUG_ASSERT(0);
@ -4675,6 +4731,14 @@ public:
String *print_item_value(THD *thd, Item *item, String *str) const override;
double Item_func_min_max_val_real(Item_func_min_max *) const override;
longlong Item_func_min_max_val_int(Item_func_min_max *) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
my_decimal *Item_func_min_max_val_decimal(Item_func_min_max *,
my_decimal *) const override;
bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*,
@ -5217,6 +5281,14 @@ public:
void sort_length(THD *thd,
const Type_std_attributes *item,
SORT_FIELD_ATTR *attr) const override;
bool Column_definition_prepare_stage1(THD *thd,
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Item_const_eq(const Item_const *a, const Item_const *b,
bool binary_cmp) const override;
bool Item_param_set_from_value(THD *thd,
@ -5317,11 +5389,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override;
void
Column_definition_attributes_frm_pack(const Column_definition_attributes *at,
@ -5450,6 +5524,12 @@ class Type_handler_general_purpose_string: public Type_handler_string_result
{
public:
bool is_general_purpose_string_type() const override { return true; }
bool Column_definition_bulk_alter(Column_definition *c,
const Column_derived_attributes
*derived_attr,
const Column_bulk_alter_attributes
*bulk_alter_attr)
const override;
};
@ -5842,11 +5922,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
@ -6690,11 +6772,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
@ -6745,11 +6829,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
@ -7179,12 +7265,13 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags)
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_redefine_stage1(Column_definition *def,
const Column_definition *dup,
const handler *file,
const Schema_specification_st *schema)
const handler *file)
const override;
void Item_param_set_param_func(Item_param *param,
uchar **pos, ulong len) const override;

View File

@ -279,8 +279,11 @@ bool Type_handler_geometry::
MEM_ROOT *mem_root,
Column_definition *def,
handler *file,
ulonglong table_flags) const
ulonglong table_flags,
const Column_derived_attributes
*derived_attr) const
{
def->charset= &my_charset_bin;
def->create_length_to_internal_length_string();
return def->prepare_blob_field(thd);
}

View File

@ -108,7 +108,10 @@ public:
MEM_ROOT *mem_root,
Column_definition *c,
handler *file,
ulonglong table_flags) const override;
ulonglong table_flags,
const Column_derived_attributes
*derived_attr)
const override;
bool Column_definition_prepare_stage2(Column_definition *c,
handler *file,
ulonglong table_flags) const override;

View File

@ -4719,7 +4719,7 @@ void update_create_info_from_table(HA_CREATE_INFO *create_info, TABLE *table)
create_info->row_type= share->row_type;
create_info->key_block_size= share->key_block_size;
create_info->default_table_charset= share->table_charset;
create_info->table_charset= 0;
create_info->alter_table_convert_to_charset= 0;
create_info->comment= share->comment;
create_info->transactional= share->transactional;
create_info->page_checksum= share->page_checksum;

View File

@ -3425,7 +3425,9 @@ int ha_federatedx::create(const char *name, TABLE *table_arg,
{
FEDERATEDX_SERVER server;
fill_server(thd->mem_root, &server, &tmp_share, create_info->table_charset);
// It's possibly wrong to use alter_table_convert_to_charset here.
fill_server(thd->mem_root, &server, &tmp_share,
create_info->alter_table_convert_to_charset);
#ifndef DBUG_OFF
mysql_mutex_init(fe_key_mutex_FEDERATEDX_SERVER_mutex,