Commit 7c8c9a8b authored by Varun Gupta's avatar Varun Gupta

MDEV-15241: make SIGNAL maximum MESSAGE_TEXT length a larger value

Increasing the length of MESSAGE_TEXT from 128 to MYSQL_ERRMSG_SIZE which is the max length of the
error message
parent e6a9ce27
...@@ -1132,7 +1132,7 @@ DECLARE hhhx VARCHAR(65); ...@@ -1132,7 +1132,7 @@ DECLARE hhhx VARCHAR(65);
DECLARE iiix VARCHAR(65); DECLARE iiix VARCHAR(65);
DECLARE jjjx VARCHAR(65); DECLARE jjjx VARCHAR(65);
DECLARE kkkx VARCHAR(65); DECLARE kkkx VARCHAR(65);
DECLARE lllx VARCHAR(129); DECLARE lllx VARCHAR(513);
DECLARE warn CONDITION FOR SQLSTATE "01234"; DECLARE warn CONDITION FOR SQLSTATE "01234";
set aaax= concat(repeat("A", 64), "X"); set aaax= concat(repeat("A", 64), "X");
set bbbx= concat(repeat("B", 64), "X"); set bbbx= concat(repeat("B", 64), "X");
...@@ -1145,9 +1145,9 @@ set hhhx= concat(repeat("H", 64), "X"); ...@@ -1145,9 +1145,9 @@ set hhhx= concat(repeat("H", 64), "X");
set iiix= concat(repeat("I", 64), "X"); set iiix= concat(repeat("I", 64), "X");
set jjjx= concat(repeat("J", 64), "X"); set jjjx= concat(repeat("J", 64), "X");
set kkkx= concat(repeat("K", 64), "X"); set kkkx= concat(repeat("K", 64), "X");
set lllx= concat(repeat("1", 100), set lllx= concat(repeat("1", 500),
repeat("2", 20), repeat("2", 10),
repeat("8", 8), repeat("8", 2),
"X"); "X");
SIGNAL warn SET SIGNAL warn SET
CLASS_ORIGIN = aaax, CLASS_ORIGIN = aaax,
...@@ -1176,7 +1176,7 @@ Warning 1647 Data truncated for condition item 'TABLE_NAME' ...@@ -1176,7 +1176,7 @@ Warning 1647 Data truncated for condition item 'TABLE_NAME'
Warning 1647 Data truncated for condition item 'COLUMN_NAME' Warning 1647 Data truncated for condition item 'COLUMN_NAME'
Warning 1647 Data truncated for condition item 'CURSOR_NAME' Warning 1647 Data truncated for condition item 'CURSOR_NAME'
Warning 1647 Data truncated for condition item 'MESSAGE_TEXT' Warning 1647 Data truncated for condition item 'MESSAGE_TEXT'
Warning 10000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112222222222222222222288888888 Warning 10000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222288
drop procedure test_signal $$ drop procedure test_signal $$
set sql_mode = DEFAULT $$ set sql_mode = DEFAULT $$
create procedure test_signal() create procedure test_signal()
......
...@@ -1360,7 +1360,7 @@ begin ...@@ -1360,7 +1360,7 @@ begin
DECLARE iiix VARCHAR(65); DECLARE iiix VARCHAR(65);
DECLARE jjjx VARCHAR(65); DECLARE jjjx VARCHAR(65);
DECLARE kkkx VARCHAR(65); DECLARE kkkx VARCHAR(65);
DECLARE lllx VARCHAR(129); DECLARE lllx VARCHAR(513);
DECLARE warn CONDITION FOR SQLSTATE "01234"; DECLARE warn CONDITION FOR SQLSTATE "01234";
...@@ -1375,9 +1375,9 @@ begin ...@@ -1375,9 +1375,9 @@ begin
set iiix= concat(repeat("I", 64), "X"); set iiix= concat(repeat("I", 64), "X");
set jjjx= concat(repeat("J", 64), "X"); set jjjx= concat(repeat("J", 64), "X");
set kkkx= concat(repeat("K", 64), "X"); set kkkx= concat(repeat("K", 64), "X");
set lllx= concat(repeat("1", 100), set lllx= concat(repeat("1", 500),
repeat("2", 20), repeat("2", 10),
repeat("8", 8), repeat("8", 2),
"X"); "X");
SIGNAL warn SET SIGNAL warn SET
......
...@@ -36,7 +36,7 @@ Warning 1265 Data truncated for column 'utf8_var' at row 1 ...@@ -36,7 +36,7 @@ Warning 1265 Data truncated for column 'utf8_var' at row 1
call p2; call p2;
length(msg) msg length(msg) msg
129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX 129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR 55555: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ERROR 55555: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
call p3; call p3;
length(name) name length(name) name
65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX 65 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
...@@ -54,8 +54,8 @@ end ...@@ -54,8 +54,8 @@ end
$$ $$
create procedure p2() create procedure p2()
begin begin
declare msg VARCHAR(129) CHARACTER SET UTF8; declare msg VARCHAR(513) CHARACTER SET UTF8;
set msg = concat(repeat('A', 128), 'X'); set msg = concat(repeat('A', 512), 'X');
select length(msg), msg; select length(msg), msg;
signal sqlstate '55555' set message_text = msg; signal sqlstate '55555' set message_text = msg;
end end
...@@ -74,7 +74,7 @@ call p; ...@@ -74,7 +74,7 @@ call p;
ERROR 22001: Data too long for column 'utf8_var' at row 1 ERROR 22001: Data too long for column 'utf8_var' at row 1
call p2; call p2;
length(msg) msg length(msg) msg
129 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX 513 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAX
ERROR HY000: Data too long for condition item 'MESSAGE_TEXT' ERROR HY000: Data too long for condition item 'MESSAGE_TEXT'
call p3; call p3;
length(name) name length(name) name
......
...@@ -69,8 +69,8 @@ $$ ...@@ -69,8 +69,8 @@ $$
create procedure p2() create procedure p2()
begin begin
declare msg VARCHAR(129) CHARACTER SET UTF8; declare msg VARCHAR(513) CHARACTER SET UTF8;
set msg = concat(repeat('A', 128), 'X'); set msg = concat(repeat('A', 512), 'X');
select length(msg), msg; select length(msg), msg;
signal sqlstate '55555' set message_text = msg; signal sqlstate '55555' set message_text = msg;
......
...@@ -262,12 +262,13 @@ int Sql_cmd_common_signal::eval_signal_informations(THD *thd, Sql_condition *con ...@@ -262,12 +262,13 @@ int Sql_cmd_common_signal::eval_signal_informations(THD *thd, Sql_condition *con
} }
/* /*
Enforce that SET MESSAGE_TEXT = <value> evaluates the value Enforce that SET MESSAGE_TEXT = <value> evaluates the value
as VARCHAR(128) CHARACTER SET UTF8. as VARCHAR(MYSQL_ERRMSG_SIZE) CHARACTER SET UTF8.
*/ */
bool truncated; bool truncated;
String utf8_text; String utf8_text;
str= set->val_str(& str_value); str= set->val_str(& str_value);
truncated= assign_fixed_string(thd->mem_root, & my_charset_utf8_bin, 128, truncated= assign_fixed_string(thd->mem_root, & my_charset_utf8_bin,
MYSQL_ERRMSG_SIZE,
& utf8_text, str); & utf8_text, str);
if (truncated) if (truncated)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment