Skip to content
  • Gopal Shankar's avatar
    2103f3fc
    Bug#11754608 MYSQL DOESN'T SHOW WHAT COLLATION WAS USED IF THAT COLLATION IS THE DEFAU · 2103f3fc
    Gopal Shankar authored
    The problem is, if user explicitly specifies a collation or a
    charset name for a column, which is same as server default
    collation, then the SHOW CREATE TABLE command does not show them.
    If the output of SHOW command is executed on a server with
    different default collation, then the column would be assigned
    with collation same as server default collation, and the
    collation that was explicitly specified by user originally is
    lost.
    
    The collation is either specified explicitly by user in CREATE
    TABLE command or it is implicitly assigned based on current
    server defaults. The server stores the collation, but it does not
    have information if the collation was explicitly specified by
    user or was picked-up implicitly. SHOW CREATE TABLE command just
    ignores showing the collation information if the collation is
    same as server default character name or collation.
    
    The expectation is that the SHOW CREATE TABLE command should
    always show the collation if user originally did explicitly
    specify the collation. This patch stores a boolean flag in new
    dictionary column mysql.columns.is_explicit_collation indicating if
    collation was explicitly provided by user. SHOW CREATE TABLE uses
    this information to always show collation information if user
    specified it explicitly. SHOW CREATE TABLE always displays both
    character set name and collation for a table, if user has
    explicitly provided one of character set name or the collation
    name.
    
    A test case is added in main.show_check.
    
    Change-Id: I424c0977b5d51db13f7298ee312d07920ef0d191
    2103f3fc
    Bug#11754608 MYSQL DOESN'T SHOW WHAT COLLATION WAS USED IF THAT COLLATION IS THE DEFAU
    Gopal Shankar authored
    The problem is, if user explicitly specifies a collation or a
    charset name for a column, which is same as server default
    collation, then the SHOW CREATE TABLE command does not show them.
    If the output of SHOW command is executed on a server with
    different default collation, then the column would be assigned
    with collation same as server default collation, and the
    collation that was explicitly specified by user originally is
    lost.
    
    The collation is either specified explicitly by user in CREATE
    TABLE command or it is implicitly assigned based on current
    server defaults. The server stores the collation, but it does not
    have information if the collation was explicitly specified by
    user or was picked-up implicitly. SHOW CREATE TABLE command just
    ignores showing the collation information if the collation is
    same as server default character name or collation.
    
    The expectation is that the SHOW CREATE TABLE command should
    always show the collation if user originally did explicitly
    specify the collation. This patch stores a boolean flag in new
    dictionary column mysql.columns.is_explicit_collation indicating if
    collation was explicitly provided by user. SHOW CREATE TABLE uses
    this information to always show collation information if user
    specified it explicitly. SHOW CREATE TABLE always displays both
    character set name and collation for a table, if user has
    explicitly provided one of character set name or the collation
    name.
    
    A test case is added in main.show_check.
    
    Change-Id: I424c0977b5d51db13f7298ee312d07920ef0d191
Loading