mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#41465: confusing error message when comment is too long
The problem was that the server was trying to use the unknown error format string (ER_UNKNOWN_ERROR) to print messages about comments being too long, but the said format string does not accept arguments and will always default to "Unknown error". The solution is to introduce new error messages which are specific to the error conditions so that server wants to signal -- this also means that it's possible to translate those messages. mysql-test/r/strict.result: Update test case result. mysql-test/t/strict.test: Update test case with new errors. sql/share/errmsg.txt: Introduce new errors for long comments. sql/unireg.cc: Use new errors.
This commit is contained in:
@ -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
|
||||
|
@ -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*
|
||||
|
Reference in New Issue
Block a user