to issue<44184376>:fix udf argument issue

This commit is contained in:
hanr881
2023-08-11 07:42:30 +00:00
committed by ob-robot
parent d23b1c10fc
commit e88540ebc8
4 changed files with 18 additions and 32 deletions

View File

@ -88,6 +88,7 @@ int ObPLRouter::check_error_in_resolve(int code)
case OB_ERR_SP_NO_DROP_SP:
case OB_ERR_SP_BAD_CONDITION_TYPE:
case OB_ERR_DUP_SIGNAL_SET:
case OB_ERR_WRONG_PARAMETERS_TO_NATIVE_FCT:
case OB_ERR_CANNOT_UPDATE_VIRTUAL_COL_IN_TRG:
case OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK: {
if (lib::is_mysql_mode()) {

View File

@ -142,6 +142,9 @@ int ObExprUDF::calc_result_typeN(ObExprResType &type,
}
}
}
if (OB_SUCC(ret) && lib::is_mysql_mode()) {
type_ctx.set_cast_mode(type_ctx.get_cast_mode() & ~CM_WARN_ON_FAIL);
}
}
return ret;
}

View File

@ -1155,24 +1155,15 @@ CREATE FUNCTION f1(arg TINYINT UNSIGNED) RETURNS TINYINT
BEGIN
RETURN arg;
END|
SELECT f1(-2500);
+-----------+
| f1(-2500) |
+-----------+
| 0 |
+-----------+
ERROR 22003: Out of range value for column
## SET @@sql_mode = 'traditional';
SET @@sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
## --error ER_WARN_DATA_OUT_OF_RANGE
SELECT f1(-2500);
+-----------+
| f1(-2500) |
+-----------+
| 0 |
+-----------+
ERROR 22003: Out of range value for column
DROP FUNCTION f1;
@ -1183,11 +1174,7 @@ END|
## --error ER_WARN_DATA_OUT_OF_RANGE
SELECT f1(-2500);
+-----------+
| f1(-2500) |
+-----------+
| 0 |
+-----------+
ERROR 22003: Out of range value for column
## SET @@sql_mode = 'ansi';
set @@sql_mode = "PIPES_AS_CONCAT,ONLY_FULL_GROUP_BY";
@ -1208,22 +1195,14 @@ BEGIN
END|
SELECT f1(8388699);
+-------------+
| f1(8388699) |
+-------------+
| 8388607 |
+-------------+
ERROR 22003: Out of range value for column
## SET @@sql_mode = 'traditional';
SET @@sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
## --error ER_WARN_DATA_OUT_OF_RANGE
SELECT f1(8388699);
+-------------+
| f1(8388699) |
+-------------+
| 8388607 |
+-------------+
ERROR 22003: Out of range value for column
DROP FUNCTION f1;
@ -1234,11 +1213,7 @@ END|
## --error ER_WARN_DATA_OUT_OF_RANGE
SELECT f1(8388699);
+-------------+
| f1(8388699) |
+-------------+
| 8388607 |
+-------------+
ERROR 22003: Out of range value for column
## SET @@sql_mode = 'ansi';
set @@sql_mode = "PIPES_AS_CONCAT,ONLY_FULL_GROUP_BY";

View File

@ -843,7 +843,8 @@ BEGIN
RETURN arg;
END|
delimiter ;|
# mysql8.0 会报错
--error 1264
SELECT f1(-2500);
# Call in TRADITIONAL mode the function created in ANSI mode.
@ -853,6 +854,7 @@ SET @@sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
# TODO: a warning should be emitted here.
## --error ER_WARN_DATA_OUT_OF_RANGE
--error 1264
SELECT f1(-2500);
# Recreate the function in TRADITIONAL mode.
@ -867,6 +869,7 @@ END|
delimiter ;|
## --error ER_WARN_DATA_OUT_OF_RANGE
--error 1264
SELECT f1(-2500);
#
@ -915,6 +918,8 @@ BEGIN
END|
delimiter ;|
#mysql 8.0报错
--error 1264
SELECT f1(8388699);
# Call in TRADITIONAL mode the function created in ANSI mode.
@ -924,6 +929,7 @@ SET @@sql_mode = 'STRICT_TRANS_TABLES,STRICT_ALL_TABLES';
# TODO: a warning should be emitted here.
## --error ER_WARN_DATA_OUT_OF_RANGE
--error 1264
SELECT f1(8388699);
# Recreate the function in TRADITIONAL mode.
@ -938,6 +944,7 @@ END|
delimiter ;|
## --error ER_WARN_DATA_OUT_OF_RANGE
--error 1264
SELECT f1(8388699);
#