Skip to content

Commit 6857cb5

Browse files
author
Alexander Barkov
committed
MDEV-13967 Parameter data type control for Item_long_func
- Implementing stricter data type control for Item_long_func descendants - Cleanup: renaming Type_handler::can_return_str_ascii() to can_return_text() (a better name).
1 parent aa582de commit 6857cb5

18 files changed

+660
-39
lines changed

mysql-test/r/func_int.result

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,102 @@ ERROR HY000: Illegal parameter data type row for operation 'inet_aton'
3333
SELECT LAST_INSERT_ID(ROW(1,1));
3434
ERROR HY000: Illegal parameter data type row for operation 'last_insert_id'
3535
#
36+
# MDEV-13967 Parameter data type control for Item_long_func
37+
#
38+
SELECT STRCMP(ROW(1,1),'');
39+
ERROR HY000: Illegal parameter data type row for operation 'strcmp'
40+
SELECT STRCMP('',ROW(1,1));
41+
ERROR HY000: Illegal parameter data type row for operation 'strcmp'
42+
SELECT CHAR_LENGTH(ROW(1,1));
43+
ERROR HY000: Illegal parameter data type row for operation 'char_length'
44+
SELECT OCTET_LENGTH(ROW(1,1));
45+
ERROR HY000: Illegal parameter data type row for operation 'octet_length'
46+
SELECT UNCOMPRESSED_LENGTH(ROW(1,1));
47+
ERROR HY000: Illegal parameter data type row for operation 'uncompressed_length'
48+
SELECT COERCIBILITY(ROW(1,1));
49+
ERROR HY000: Illegal parameter data type row for operation 'coercibility'
50+
SELECT ASCII(ROW(1,1));
51+
ERROR HY000: Illegal parameter data type row for operation 'ascii'
52+
SELECT CRC32(ROW(1,1));
53+
ERROR HY000: Illegal parameter data type row for operation 'crc32'
54+
SELECT ORD(ROW(1,1));
55+
ERROR HY000: Illegal parameter data type row for operation 'ord'
56+
SELECT SIGN(ROW(1,1));
57+
ERROR HY000: Illegal parameter data type row for operation 'sign'
58+
SELECT LOCATE(ROW(1,1),'a',1);
59+
ERROR HY000: Illegal parameter data type row for operation 'locate'
60+
SELECT LOCATE('a',ROW(1,1),1);
61+
ERROR HY000: Illegal parameter data type row for operation 'locate'
62+
SELECT LOCATE('a','a',ROW(1,1));
63+
ERROR HY000: Illegal parameter data type row for operation 'locate'
64+
SELECT BIT_COUNT(ROW(1,1));
65+
ERROR HY000: Illegal parameter data type row for operation 'bit_count'
66+
SELECT BENCHMARK(1, ROW(1,1));
67+
ERROR 21000: Operand should contain 1 column(s)
68+
SELECT BENCHMARK(ROW(1,1),'');
69+
ERROR HY000: Illegal parameter data type row for operation 'benchmark'
70+
SELECT SLEEP(ROW(1,1));
71+
ERROR HY000: Illegal parameter data type row for operation 'sleep'
72+
SELECT GET_LOCK('x', ROW(1,1));
73+
ERROR HY000: Illegal parameter data type row for operation 'get_lock'
74+
SELECT GET_LOCK(ROW(1,1),'x');
75+
ERROR HY000: Illegal parameter data type row for operation 'get_lock'
76+
SELECT PERIOD_ADD(ROW(1,1),1);
77+
ERROR HY000: Illegal parameter data type row for operation 'period_add'
78+
SELECT PERIOD_ADD(1,ROW(1,1));
79+
ERROR HY000: Illegal parameter data type row for operation 'period_add'
80+
SELECT PERIOD_DIFF(ROW(1,1),1);
81+
ERROR HY000: Illegal parameter data type row for operation 'period_diff'
82+
SELECT PERIOD_DIFF(1,ROW(1,1));
83+
ERROR HY000: Illegal parameter data type row for operation 'period_diff'
84+
SELECT TO_DAYS(ROW(1,1));
85+
ERROR HY000: Illegal parameter data type row for operation 'to_days'
86+
SELECT DAYOFMONTH(ROW(1,1));
87+
ERROR HY000: Illegal parameter data type row for operation 'dayofmonth'
88+
SELECT DAYOFYEAR(ROW(1,1));
89+
ERROR HY000: Illegal parameter data type row for operation 'dayofyear'
90+
SELECT QUARTER(ROW(1,1));
91+
ERROR HY000: Illegal parameter data type row for operation 'quarter'
92+
SELECT YEAR(ROW(1,1));
93+
ERROR HY000: Illegal parameter data type row for operation 'year'
94+
SELECT YEARWEEK(ROW(1,1));
95+
ERROR HY000: Illegal parameter data type row for operation 'yearweek'
96+
SELECT WEEK(ROW(1,1));
97+
ERROR HY000: Illegal parameter data type row for operation 'week'
98+
SELECT WEEK(ROW(1,1),1);
99+
ERROR HY000: Illegal parameter data type row for operation 'week'
100+
SELECT WEEK(1,ROW(1,1));
101+
ERROR HY000: Illegal parameter data type row for operation 'week'
102+
SELECT HOUR(ROW(1,1));
103+
ERROR HY000: Illegal parameter data type row for operation 'hour'
104+
SELECT MINUTE(ROW(1,1));
105+
ERROR HY000: Illegal parameter data type row for operation 'minute'
106+
SELECT SECOND(ROW(1,1));
107+
ERROR HY000: Illegal parameter data type row for operation 'second'
108+
SELECT MICROSECOND(ROW(1,1));
109+
ERROR HY000: Illegal parameter data type row for operation 'microsecond'
110+
SELECT JSON_DEPTH(ROW(1,1));
111+
ERROR HY000: Illegal parameter data type row for operation 'json_depth'
112+
SELECT JSON_LENGTH(ROW(1,1));
113+
ERROR HY000: Illegal parameter data type row for operation 'json_length'
114+
SELECT JSON_LENGTH('json', ROW(1,1));
115+
ERROR HY000: Illegal parameter data type row for operation 'json_length'
116+
SELECT JSON_LENGTH(ROW(1,1), ROW(1,1));
117+
ERROR HY000: Illegal parameter data type row for operation 'json_length'
118+
SELECT REGEXP_INSTR(ROW(1,1),'');
119+
ERROR HY000: Illegal parameter data type row for operation 'regexp_instr'
120+
SELECT REGEXP_INSTR('',ROW(1,1));
121+
ERROR HY000: Illegal parameter data type row for operation 'regexp_instr'
122+
SELECT FIND_IN_SET(ROW(1,1),'');
123+
ERROR HY000: Illegal parameter data type row for operation 'find_in_set'
124+
SELECT FIND_IN_SET('',ROW(1,1));
125+
ERROR HY000: Illegal parameter data type row for operation 'find_in_set'
126+
SELECT RELEASE_LOCK(ROW(1,1));
127+
ERROR HY000: Illegal parameter data type row for operation 'release_lock'
128+
SELECT IS_FREE_LOCK(ROW(1,1));
129+
ERROR HY000: Illegal parameter data type row for operation 'is_free_lock'
130+
SELECT IS_USED_LOCK(ROW(1,1));
131+
ERROR HY000: Illegal parameter data type row for operation 'is_used_lock'
132+
#
36133
# End of 10.3 tests
37134
#

mysql-test/r/func_regexp.result

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,9 @@ SELECT ' ' REGEXP '[[:space:]]';
157157
SELECT '\t' REGEXP '[[:space:]]';
158158
'\t' REGEXP '[[:space:]]'
159159
1
160+
#
161+
# MDEV-13967 Parameter data type control for Item_long_func
162+
#
163+
SELECT REGEXP_INSTR('111222333',2);
164+
REGEXP_INSTR('111222333',2)
165+
4

mysql-test/r/gis.result

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4817,5 +4817,106 @@ ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
48174817
SELECT CONVERT_TZ(1, 1, POINT(1,1));
48184818
ERROR HY000: Illegal parameter data type geometry for operation 'convert_tz'
48194819
#
4820+
# MDEV-13967 Parameter data type control for Item_long_func
4821+
#
4822+
SELECT STRCMP(POINT(1,1),POINT(1,1));
4823+
STRCMP(POINT(1,1),POINT(1,1))
4824+
0
4825+
SELECT CHAR_LENGTH(POINT(1,1));
4826+
CHAR_LENGTH(POINT(1,1))
4827+
25
4828+
SELECT OCTET_LENGTH(POINT(1,1));
4829+
OCTET_LENGTH(POINT(1,1))
4830+
25
4831+
SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
4832+
UNCOMPRESSED_LENGTH(POINT(1,1))
4833+
0
4834+
SELECT COERCIBILITY(POINT(1,1));
4835+
COERCIBILITY(POINT(1,1))
4836+
4
4837+
SELECT ASCII(POINT(1,1));
4838+
ASCII(POINT(1,1))
4839+
0
4840+
SELECT CRC32(POINT(1,1));
4841+
CRC32(POINT(1,1))
4842+
1349318989
4843+
SELECT ORD(POINT(1,1));
4844+
ORD(POINT(1,1))
4845+
0
4846+
SELECT SIGN(POINT(1,1));
4847+
ERROR HY000: Illegal parameter data type geometry for operation 'sign'
4848+
SELECT LOCATE('a','a',POINT(1,1));
4849+
ERROR HY000: Illegal parameter data type geometry for operation 'locate'
4850+
SELECT LOCATE(POINT(1,1),POINT(1,1));
4851+
LOCATE(POINT(1,1),POINT(1,1))
4852+
1
4853+
SELECT BIT_COUNT(POINT(1,1));
4854+
ERROR HY000: Illegal parameter data type geometry for operation 'bit_count'
4855+
SELECT BENCHMARK(POINT(1,1),'');
4856+
ERROR HY000: Illegal parameter data type geometry for operation 'benchmark'
4857+
SELECT SLEEP(POINT(1,1));
4858+
ERROR HY000: Illegal parameter data type geometry for operation 'sleep'
4859+
SELECT GET_LOCK('x', POINT(1,1));
4860+
ERROR HY000: Illegal parameter data type geometry for operation 'get_lock'
4861+
SELECT PERIOD_ADD(POINT(1,1),1);
4862+
ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
4863+
SELECT PERIOD_ADD(1,POINT(1,1));
4864+
ERROR HY000: Illegal parameter data type geometry for operation 'period_add'
4865+
SELECT PERIOD_DIFF(POINT(1,1),1);
4866+
ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
4867+
SELECT PERIOD_DIFF(1,POINT(1,1));
4868+
ERROR HY000: Illegal parameter data type geometry for operation 'period_diff'
4869+
SELECT TO_DAYS(POINT(1,1));
4870+
ERROR HY000: Illegal parameter data type geometry for operation 'to_days'
4871+
SELECT DAYOFMONTH(POINT(1,1));
4872+
ERROR HY000: Illegal parameter data type geometry for operation 'dayofmonth'
4873+
SELECT DAYOFYEAR(POINT(1,1));
4874+
ERROR HY000: Illegal parameter data type geometry for operation 'dayofyear'
4875+
SELECT QUARTER(POINT(1,1));
4876+
ERROR HY000: Illegal parameter data type geometry for operation 'quarter'
4877+
SELECT YEAR(POINT(1,1));
4878+
ERROR HY000: Illegal parameter data type geometry for operation 'year'
4879+
SELECT YEARWEEK(POINT(1,1));
4880+
ERROR HY000: Illegal parameter data type geometry for operation 'yearweek'
4881+
SELECT WEEK(POINT(1,1));
4882+
ERROR HY000: Illegal parameter data type geometry for operation 'week'
4883+
SELECT WEEK(POINT(1,1),1);
4884+
ERROR HY000: Illegal parameter data type geometry for operation 'week'
4885+
SELECT WEEK(1,POINT(1,1));
4886+
ERROR HY000: Illegal parameter data type geometry for operation 'week'
4887+
SELECT HOUR(POINT(1,1));
4888+
ERROR HY000: Illegal parameter data type geometry for operation 'hour'
4889+
SELECT MINUTE(POINT(1,1));
4890+
ERROR HY000: Illegal parameter data type geometry for operation 'minute'
4891+
SELECT SECOND(POINT(1,1));
4892+
ERROR HY000: Illegal parameter data type geometry for operation 'second'
4893+
SELECT MICROSECOND(POINT(1,1));
4894+
ERROR HY000: Illegal parameter data type geometry for operation 'microsecond'
4895+
SELECT JSON_DEPTH(POINT(1,1));
4896+
ERROR HY000: Illegal parameter data type geometry for operation 'json_depth'
4897+
SELECT JSON_LENGTH(POINT(1,1));
4898+
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
4899+
SELECT JSON_LENGTH('json', POINT(1,1));
4900+
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
4901+
SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
4902+
ERROR HY000: Illegal parameter data type geometry for operation 'json_length'
4903+
SELECT REGEXP_INSTR(POINT(1,1),'');
4904+
REGEXP_INSTR(POINT(1,1),'')
4905+
1
4906+
SELECT REGEXP_INSTR('',POINT(1,1));
4907+
ERROR HY000: Illegal parameter data type geometry for operation 'regexp_instr'
4908+
SELECT FIND_IN_SET(POINT(1,1),'');
4909+
FIND_IN_SET(POINT(1,1),'')
4910+
0
4911+
SELECT FIND_IN_SET('',POINT(1,1));
4912+
FIND_IN_SET('',POINT(1,1))
4913+
0
4914+
SELECT RELEASE_LOCK(POINT(1,1));
4915+
ERROR HY000: Illegal parameter data type geometry for operation 'release_lock'
4916+
SELECT IS_FREE_LOCK(POINT(1,1));
4917+
ERROR HY000: Illegal parameter data type geometry for operation 'is_free_lock'
4918+
SELECT IS_USED_LOCK(POINT(1,1));
4919+
ERROR HY000: Illegal parameter data type geometry for operation 'is_used_lock'
4920+
#
48204921
# End of 10.3 tests
48214922
#

mysql-test/suite/rpl/r/rpl_gtid_basic.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,3 +568,16 @@ ERROR HY000: Function or expression 'binlog_gtid_pos()' cannot be used in the DE
568568
#
569569
# End of 10.2 tests
570570
#
571+
#
572+
# Start of 10.3 tests
573+
#
574+
#
575+
# MDEV-13967 Parameter data type control for Item_long_func
576+
#
577+
SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
578+
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
579+
SELECT MASTER_GTID_WAIT('str',ROW(1,1));
580+
ERROR HY000: Illegal parameter data type row for operation 'master_gtid_wait'
581+
#
582+
# End of 10.3 tests
583+
#

mysql-test/suite/rpl/t/rpl_gtid_basic.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,23 @@ CREATE TABLE t1 (a VARCHAR(100) DEFAULT BINLOG_GTID_POS("master-bin.000001", 600
1414
--echo #
1515
--echo # End of 10.2 tests
1616
--echo #
17+
18+
19+
--echo #
20+
--echo # Start of 10.3 tests
21+
--echo #
22+
23+
--echo #
24+
--echo # MDEV-13967 Parameter data type control for Item_long_func
25+
--echo #
26+
27+
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
28+
SELECT MASTER_GTID_WAIT(ROW(1,1),'str');
29+
30+
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
31+
SELECT MASTER_GTID_WAIT('str',ROW(1,1));
32+
33+
34+
--echo #
35+
--echo # End of 10.3 tests
36+
--echo #

0 commit comments

Comments
 (0)