1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-27743 Remove Lex::charset

This patch also fixes:

MDEV-27690 Crash on `CHARACTER SET csname COLLATE DEFAULT` in column definition
MDEV-27853 Wrong data type on column `COLLATE DEFAULT` and table `COLLATE some_non_default_collation`
MDEV-28067 Multiple conflicting column COLLATE clauses are not rejected
MDEV-28118 Wrong collation of `CAST(.. AS CHAR COLLATE DEFAULT)`
MDEV-28119 Wrong column collation on MODIFY + CONVERT
This commit is contained in:
Alexander Barkov
2022-02-09 21:21:39 +04:00
parent d25b10fede
commit 0c4c064f98
34 changed files with 13752 additions and 242 deletions

View File

@ -2713,11 +2713,10 @@ bool
Type_handler::Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
CHARSET_INFO *cs,
column_definition_type_t type)
const
{
def->charset= cs;
def->set_lex_charset_collation(attr.lex_charset_collation());
def->set_length_and_dec(attr);
return false;
}
@ -2746,11 +2745,10 @@ Type_handler_string::Column_definition_set_attributes(
THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
CHARSET_INFO *cs,
column_definition_type_t type)
const
{
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
Type_handler::Column_definition_set_attributes(thd, def, attr, type);
if (attr.has_explicit_length())
return false;
switch (type) {
@ -2778,11 +2776,10 @@ Type_handler_varchar::Column_definition_set_attributes(
THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
CHARSET_INFO *cs,
column_definition_type_t type)
const
{
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
Type_handler::Column_definition_set_attributes(thd, def, attr, type);
if (attr.has_explicit_length())
return false;
switch (type) {
@ -3156,7 +3153,7 @@ bool Type_handler_general_purpose_string::
Change character sets for all varchar/char/text columns,
but do not touch varbinary/binary/blob columns.
*/
if (defcs != &my_charset_bin)
if (!(def->flags & CONTEXT_COLLATION_FLAG) && defcs != &my_charset_bin)
def->charset= bulk_alter_attr->alter_table_convert_to_charset();
return false;
};
@ -4267,10 +4264,9 @@ Type_handler_timestamp_common::
Column_definition_set_attributes(THD *thd,
Column_definition *def,
const Lex_field_type_st &attr,
CHARSET_INFO *cs,
column_definition_type_t type) const
{
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
Type_handler::Column_definition_set_attributes(thd, def, attr, type);
if (!opt_explicit_defaults_for_timestamp)
def->flags|= NOT_NULL_FLAG;
return false;