diff options
author | Anel Husakovic <anel@mariadb.org> | 2018-11-09 06:12:43 -0800 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-05-01 19:52:27 +0200 |
commit | 2370eeb028b269243633b18f7661dca999089a41 (patch) | |
tree | 8482953dc657e1e482b5f7f8c7a08dc943fac095 /sql/sql_show.cc | |
parent | dc8e15db7e170964699dec7b5214d20200b4b182 (diff) | |
download | mariadb-git-2370eeb028b269243633b18f7661dca999089a41.tar.gz |
MDEV-17654 Incorrect syntax returned for column with CHECK constraint in the "SHOW CREATE TABLE ..." result
Prepend COMMENT before CHECK constraint in SHOW CREATE
Closes #924
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index a29a6871b78..c84ac5f4977 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2065,6 +2065,16 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, !(sql_mode & MODE_NO_FIELD_OPTIONS)) packet->append(STRING_WITH_LEN(" AUTO_INCREMENT")); } + + if (field->comment.length) + { + packet->append(STRING_WITH_LEN(" COMMENT ")); + append_unescaped(packet, field->comment.str, field->comment.length); + } + + append_create_options(thd, packet, field->option_list, check_options, + hton->field_options); + if (field->check_constraint) { StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci); @@ -2074,13 +2084,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet, packet->append(STRING_WITH_LEN(")")); } - if (field->comment.length) - { - packet->append(STRING_WITH_LEN(" COMMENT ")); - append_unescaped(packet, field->comment.str, field->comment.length); - } - append_create_options(thd, packet, field->option_list, check_options, - hton->field_options); } key_info= table->key_info; |