diff options
-rw-r--r-- | mysql-test/r/strict.result | 6 | ||||
-rw-r--r-- | mysql-test/t/strict.test | 4 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 8 | ||||
-rw-r--r-- | sql/unireg.cc | 17 |
4 files changed, 21 insertions, 14 deletions
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index 1255284f4fe..241f4198bf7 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1305,7 +1305,7 @@ set @@sql_mode='traditional'; create table t1 (i int) comment '123456789*123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*123456789*'; -ERROR HY000: Too long comment for table 't1' +ERROR HY000: Comment for table 't1' is too long (max = 60) create table t1 ( i int comment '123456789*123456789*123456789*123456789* @@ -1315,7 +1315,7 @@ i int comment 123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*'); -ERROR HY000: Too long comment for field 'i' +ERROR HY000: Comment for field 'i' is too long (max = 255) set @@sql_mode= @org_mode; create table t1 (i int comment @@ -1327,7 +1327,7 @@ create table t1 123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*'); Warnings: -Warning 1105 Unknown error +Warning 1629 Comment for field 'i' is too long (max = 255) select column_name, column_comment from information_schema.columns where table_schema = 'test' and table_name = 't1'; column_name column_comment diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index f2ce045840c..5779ea97bc2 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1163,11 +1163,11 @@ set @@sql_mode= @org_mode; # Bug #13934 Silent truncation of table comments # set @@sql_mode='traditional'; ---error 1105 +--error ER_TOO_LONG_TABLE_COMMENT create table t1 (i int) comment '123456789*123456789*123456789*123456789*123456789* 123456789*123456789*123456789*123456789*123456789*'; ---error 1105 +--error ER_TOO_LONG_FIELD_COMMENT create table t1 ( i int comment '123456789*123456789*123456789*123456789* diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 23231eefcc2..aa1521acab6 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -6169,3 +6169,11 @@ ER_CONFLICT_FN_PARSE_ERROR eng "Error in parsing conflict function. Message: %-.64s" ER_EXCEPTIONS_WRITE_ERROR eng "Write to exceptions table failed. Message: %-.128s"" + +ER_TOO_LONG_TABLE_COMMENT + eng "Comment for table '%-.64s' is too long (max = %lu)" + por "Comentário para a tabela '%-.64s' é longo demais (max = %lu)" + +ER_TOO_LONG_FIELD_COMMENT + eng "Comment for field '%-.64s' is too long (max = %lu)" + por "Comentário para o campo '%-.64s' é longo demais (max = %lu)" diff --git a/sql/unireg.cc b/sql/unireg.cc index da018ebec3d..51293184ad8 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -229,16 +229,16 @@ bool mysql_create_frm(THD *thd, const char *file_name, create_info->comment.length, 60); if (tmp_len < create_info->comment.length) { - (void) my_snprintf(buff, sizeof(buff), "Too long comment for table '%s'", - table); if ((thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { - my_message(ER_UNKNOWN_ERROR, buff, MYF(0)); + my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0), table, tmp_len); goto err; } push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff); + ER_TOO_LONG_TABLE_COMMENT, + ER(ER_TOO_LONG_TABLE_COMMENT), + table, tmp_len); create_info->comment.length= tmp_len; } @@ -613,17 +613,16 @@ static bool pack_header(uchar *forminfo, enum legacy_db_type table_type, 255); if (tmp_len < field->comment.length) { - char buff[128]; - (void) my_snprintf(buff,sizeof(buff), "Too long comment for field '%s'", - field->field_name); if ((current_thd->variables.sql_mode & (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES))) { - my_message(ER_UNKNOWN_ERROR, buff, MYF(0)); + my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name, tmp_len); DBUG_RETURN(1); } push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, - ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), buff); + ER_TOO_LONG_FIELD_COMMENT, + ER(ER_TOO_LONG_FIELD_COMMENT), + field->field_name, tmp_len); field->comment.length= tmp_len; } |