-
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
Gopal Shankar authoredThe 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