summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 6290a47ee30..746ebad0e43 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1456,7 +1456,7 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
buffer.append(STRING_WITH_LEN(" /*!40100"));
buffer.append(STRING_WITH_LEN(" DEFAULT CHARACTER SET "));
buffer.append(create.default_table_charset->cs_name);
- if (!(create.default_table_charset->state & MY_CS_PRIMARY))
+ if (Charset(create.default_table_charset).can_have_collate_clause())
{
buffer.append(STRING_WITH_LEN(" COLLATE "));
buffer.append(create.default_table_charset->coll_name);
@@ -1916,7 +1916,7 @@ static void add_table_options(THD *thd, TABLE *table,
{
packet->append(STRING_WITH_LEN(" DEFAULT CHARSET="));
packet->append(share->table_charset->cs_name);
- if (!(share->table_charset->state & MY_CS_PRIMARY))
+ if (Charset(table->s->table_charset).can_have_collate_clause())
{
packet->append(STRING_WITH_LEN(" COLLATE="));
packet->append(table->s->table_charset->coll_name);
@@ -2202,20 +2202,11 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
{
packet->append(STRING_WITH_LEN(" CHARACTER SET "));
packet->append(field->charset()->cs_name);
- }
- /*
- For string types dump collation name only if
- collation is not primary for the given charset
-
- For generated fields don't print the COLLATE clause if
- the collation matches the expression's collation.
- */
- if (!(field->charset()->state & MY_CS_PRIMARY) &&
- (!field->vcol_info ||
- field->charset() != field->vcol_info->expr->collation.collation))
- {
- packet->append(STRING_WITH_LEN(" COLLATE "));
- packet->append(field->charset()->coll_name);
+ if (Charset(field->charset()).can_have_collate_clause())
+ {
+ packet->append(STRING_WITH_LEN(" COLLATE "));
+ packet->append(field->charset()->coll_name);
+ }
}
}
@@ -3633,6 +3624,7 @@ union Any_pointer {
@param variable [in] Details of the variable.
@param value_type [in] Variable type.
@param show_type [in] Variable show type.
+ @param status_var [in] Status variable pointer
@param charset [out] Character set of the value.
@param buff [in,out] Buffer to store the value.
(Needs to have enough memory