Commit 428f03c0 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-8839 COLUMN_GET() produces warnings with no data

parent e5418942
......@@ -346,5 +346,24 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# MDEV-8839 COLUMN_GET() produces warnings with no data
#
SET @aaa= COLUMN_CREATE('price', _binary 0xF0F1F2F3F4F5F6F7);
SELECT COLUMN_GET(@aaa, 'price' AS DECIMAL) aaa;
aaa
0
Warnings:
Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when converting to DECIMAL
SELECT COLUMN_GET(@aaa, 'price' AS INT) aaa;
aaa
0
Warnings:
Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when converting to INT
SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa;
aaa
0
Warnings:
Warning 1918 Encountered illegal value '\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7' when converting to DOUBLE
#
# End of 10.1 tests
#
......@@ -302,6 +302,15 @@ CREATE TABLE t1 (a DATETIME, b TIMESTAMP AS (TIMESTAMP(a)),c TIMESTAMP);
SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-8839 COLUMN_GET() produces warnings with no data
--echo #
SET @aaa= COLUMN_CREATE('price', _binary 0xF0F1F2F3F4F5F6F7);
SELECT COLUMN_GET(@aaa, 'price' AS DECIMAL) aaa;
SELECT COLUMN_GET(@aaa, 'price' AS INT) aaa;
SELECT COLUMN_GET(@aaa, 'price' AS DOUBLE) aaa;
--echo #
--echo # End of 10.1 tests
--echo #
......@@ -4963,13 +4963,12 @@ longlong Item_dyncol_get::val_int()
if (end != org_end || error > 0)
{
THD *thd= current_thd;
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
ER_THD(thd, ER_BAD_DATA),
buff,
ErrConvString(val.x.string.value.str,
val.x.string.value.length,
val.x.string.charset).ptr(),
unsigned_flag ? "UNSIGNED INT" : "INT");
}
unsigned_flag= error >= 0;
......@@ -5028,13 +5027,13 @@ double Item_dyncol_get::val_real()
error)
{
THD *thd= current_thd;
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
ER_THD(thd, ER_BAD_DATA),
buff, "DOUBLE");
ErrConvString(val.x.string.value.str,
val.x.string.value.length,
val.x.string.charset).ptr(),
"DOUBLE");
}
return res;
}
......@@ -5085,9 +5084,6 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
int rc;
rc= str2my_decimal(0, val.x.string.value.str, val.x.string.value.length,
val.x.string.charset, decimal_value, &end);
char buff[80];
strmake(buff, val.x.string.value.str, MY_MIN(sizeof(buff)-1,
val.x.string.value.length));
if (rc != E_DEC_OK ||
end != val.x.string.value.str + val.x.string.value.length)
{
......@@ -5095,7 +5091,10 @@ my_decimal *Item_dyncol_get::val_decimal(my_decimal *decimal_value)
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_BAD_DATA,
ER_THD(thd, ER_BAD_DATA),
buff, "DECIMAL");
ErrConvString(val.x.string.value.str,
val.x.string.value.length,
val.x.string.charset).ptr(),
"DECIMAL");
}
break;
}
......
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