← Back to team overview

maria-developers team mailing list archive

Re: 68ebe0e2f5e: MDEV-29446 Change SHOW CREATE TABLE to display default collation

 

Hi, Alexander,

On Sep 09, Alexander Barkov wrote:
> revision-id: 68ebe0e2f5e (mariadb-10.3.36-25-g68ebe0e2f5e)
> parent(s): f501f815bc7
> author: Alexander Barkov
> committer: Alexander Barkov
> timestamp: 2022-09-07 08:10:58 +0400
> message:
> 
> MDEV-29446 Change SHOW CREATE TABLE to display default collation
> 
> diff --git a/sql/sql_show.cc b/sql/sql_show.cc
> index a019c3c9dbd..cdf0bc01b6a 100644
> --- a/sql/sql_show.cc
> +++ b/sql/sql_show.cc
> @@ -2253,18 +2247,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
>        {
>          packet->append(STRING_WITH_LEN(" CHARACTER SET "));
>          packet->append(field->charset()->csname);
> -      }
> -      /*
> -        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))

why, I think, this second condition could still apply, no need to remove
it.

> -      {
>          packet->append(STRING_WITH_LEN(" COLLATE "));
>          packet->append(field->charset()->name);
>        }

Note that in 10.10 you need to fix json_table code
inside a big if() condition:

          ...
          (!(m_explicit_cs->state & MY_CS_PRIMARY) &&
           (str->append(STRING_WITH_LEN(" COLLATE ")) ||
            str->append(&m_explicit_cs->coll_name))))) ||
          ...

Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx