mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-7387 [PATCH] Alter table xxx CHARACTER SET utf8, CONVERT TO CHARACTER SET latin1 should fail
A contribution from Daniel Black, with minor additional enhancements.
This commit is contained in:
@ -1637,6 +1637,33 @@ struct HA_CREATE_INFO
|
||||
bool table_was_deleted;
|
||||
|
||||
bool tmp_table() { return options & HA_LEX_CREATE_TMP_TABLE; }
|
||||
bool check_conflicting_charset_declarations(CHARSET_INFO *cs);
|
||||
bool add_table_option_default_charset(CHARSET_INFO *cs)
|
||||
{
|
||||
// cs can be NULL, e.g.: CREATE TABLE t1 (..) CHARACTER SET DEFAULT;
|
||||
if (check_conflicting_charset_declarations(cs))
|
||||
return true;
|
||||
default_table_charset= cs;
|
||||
used_fields|= HA_CREATE_USED_DEFAULT_CHARSET;
|
||||
return false;
|
||||
}
|
||||
bool add_alter_list_item_convert_to_charset(CHARSET_INFO *cs)
|
||||
{
|
||||
/*
|
||||
cs cannot be NULL, as sql_yacc.yy translates
|
||||
CONVERT TO CHARACTER SET DEFAULT
|
||||
to
|
||||
CONVERT TO CHARACTER SET <character-set-of-the-current-database>
|
||||
TODO: Should't we postpone resolution of DEFAULT until the
|
||||
character set of the table owner database is loaded from its db.opt?
|
||||
*/
|
||||
DBUG_ASSERT(cs);
|
||||
if (check_conflicting_charset_declarations(cs))
|
||||
return true;
|
||||
table_charset= default_table_charset= cs;
|
||||
used_fields|= (HA_CREATE_USED_CHARSET | HA_CREATE_USED_DEFAULT_CHARSET);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user