Commit dc41bc14 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13964 Parameter data type control for Item_real_func

parent 7131a0a8
......@@ -4668,5 +4668,92 @@ ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
SELECT MBRTOUCHES(POINT(1,1), 'test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
#
# MDEV-13964 Parameter data type control for Item_real_func
#
SELECT EXP(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'exp'
SELECT LN(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'ln'
SELECT LOG2(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'log2'
SELECT LOG10(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'log10'
SELECT SQRT(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'sqrt'
SELECT ACOS(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'acos'
SELECT ASIN(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'asin'
SELECT COS(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'cos'
SELECT SIN(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'sin'
SELECT TAN(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'tan'
SELECT COT(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'cot'
SELECT LOG(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'log'
SELECT LOG(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'log'
SELECT LOG(1, POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'log'
SELECT ATAN(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'atan'
SELECT ATAN(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'atan'
SELECT ATAN(1, POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'atan'
SELECT POW(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'pow'
SELECT RAND(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'rand'
SELECT RADIANS(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'radians'
SELECT DEGREES(POINT(1,1));
ERROR HY000: Illegal parameter data type geometry for operation 'degrees'
SELECT EXP(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'exp'
SELECT LN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'ln'
SELECT LOG2(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log2'
SELECT LOG10(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log10'
SELECT SQRT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'sqrt'
SELECT ACOS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'acos'
SELECT ASIN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'asin'
SELECT COS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'cos'
SELECT SIN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'sin'
SELECT TAN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'tan'
SELECT COT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'cot'
SELECT LOG(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT LOG(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT LOG(1, ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT ATAN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT ATAN(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT ATAN(1, ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT POW(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'pow'
SELECT RAND(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'rand'
SELECT RADIANS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'radians'
SELECT DEGREES(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'degrees'
#
# End of 10.3 tests
#
......@@ -2689,6 +2689,111 @@ SELECT MBRTOUCHES('test', POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT MBRTOUCHES(POINT(1,1), 'test');
--echo #
--echo # MDEV-13964 Parameter data type control for Item_real_func
--echo #
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT EXP(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LN(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG2(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG10(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT SQRT(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ACOS(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ASIN(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT COS(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT SIN(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT TAN(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT COT(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(POINT(1,1),POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(1, POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(POINT(1,1),POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(1, POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT POW(POINT(1,1),POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT RAND(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT RADIANS(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT DEGREES(POINT(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT EXP(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LN(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG2(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG10(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT SQRT(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ACOS(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ASIN(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT COS(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT SIN(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT TAN(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT COT(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(ROW(1,1),ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT LOG(1, ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(ROW(1,1),ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT ATAN(1, ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT POW(ROW(1,1),ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT RAND(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT RADIANS(ROW(1,1));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT DEGREES(ROW(1,1));
--echo #
--echo # End of 10.3 tests
--echo #
......@@ -1178,6 +1178,8 @@ class Item_func_abs :public Item_func_num1
class Item_dec_func :public Item_real_func
{
bool check_arguments() const
{ return check_argument_types_can_return_real(0, arg_count); }
public:
Item_dec_func(THD *thd, Item *a): Item_real_func(thd, a) {}
Item_dec_func(THD *thd, Item *a, Item *b): Item_real_func(thd, a, b) {}
......@@ -1403,6 +1405,8 @@ class Item_func_rand :public Item_real_func
{
struct my_rnd_struct *rand;
bool first_eval; // TRUE if val_real() is called 1st time
bool check_arguments() const
{ return check_argument_types_can_return_int(0, arg_count); }
public:
Item_func_rand(THD *thd, Item *a):
Item_real_func(thd, a), rand(0), first_eval(TRUE) {}
......@@ -1441,6 +1445,8 @@ class Item_func_units :public Item_real_func
{
char *name;
double mul,add;
bool check_arguments() const
{ return check_argument_types_can_return_real(0, arg_count); }
public:
Item_func_units(THD *thd, char *name_arg, Item *a, double mul_arg,
double add_arg):
......
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