1 ################################################################################
2 # t/partition_blocked_sql_funcs_main.inc #
5 # Tests around sql functions #
8 #------------------------------------------------------------------------------#
9 # Original Author: HH #
10 # Original Date: 2006-11-22 #
14 ################################################################################
16 --echo -------------------------------------------------------------------------
17 --echo --- All SQL functions should be rejected, otherwise BUG (see 18198)
18 --echo -------------------------------------------------------------------------
20 let $sqlfunc = ascii(col1);
21 let $valsqlfunc = ascii(
'a');
22 let $coltype = char(30);
23 --source suite/parts/inc/partition_blocked_sql_funcs.inc
25 let $sqlfunc = ord(col1);
26 let $valsqlfunc = ord(
'a');
27 let $coltype = char(30);
28 --source suite/parts/inc/partition_blocked_sql_funcs.inc
30 let $sqlfunc = greatest(col1,15);
31 let $valsqlfunc = greatest(1,15);
33 --source suite/parts/inc/partition_blocked_sql_funcs.inc
35 let $sqlfunc = isnull(col1);
36 let $valsqlfunc = isnull(15);
38 --source suite/parts/inc/partition_blocked_sql_funcs.inc
40 let $sqlfunc = least(col1,15);
41 let $valsqlfunc = least(15,30);
43 --source suite/parts/inc/partition_blocked_sql_funcs.inc
45 let $sqlfunc =
case when col1>15 then 20
else 10 end;
46 let $valsqlfunc =
case when 1>30 then 20
else 15 end;
48 --source suite/parts/inc/partition_blocked_sql_funcs.inc
50 let $sqlfunc = ifnull(col1,30);
51 let $valsqlfunc = ifnull(1,30);
53 --source suite/parts/inc/partition_blocked_sql_funcs.inc
55 let $sqlfunc = nullif(col1,30);
56 let $valsqlfunc = nullif(1,30);
58 --source suite/parts/inc/partition_blocked_sql_funcs.inc
60 let $sqlfunc = bit_length(col1);
61 let $valsqlfunc = bit_length(255);
63 --source suite/parts/inc/partition_blocked_sql_funcs.inc
64 let $coltype = char(30);
65 --source suite/parts/inc/partition_blocked_sql_funcs.inc
67 let $sqlfunc = char_length(col1);
68 let $valsqlfunc = char_length(
'a');
70 #--source suite/parts/inc/partition_blocked_sql_funcs.inc
71 let $coltype = char(30);
72 --source suite/parts/inc/partition_blocked_sql_funcs.inc
74 let $sqlfunc = character_length(col1);
75 let $valsqlfunc = character_length(
'a');
76 let $coltype = char(30)
77 --source suite/parts/inc/partition_blocked_sql_funcs.inc
79 let $sqlfunc = find_in_set(col1,
'1,2,3,4,5,6,7,8,9');
80 let $valsqlfunc = find_in_set(
'i',
'a,b,c,d,e,f,g,h,i');
82 --source suite/parts/inc/partition_blocked_sql_funcs.inc
83 let $coltype = char(30);
84 --source suite/parts/inc/partition_blocked_sql_funcs.inc
86 let $sqlfunc = instr(col1,
'acb');
87 let $valsqlfunc = instr(
'i',
'a,b,c,d,e,f,g,h,i');
89 --source suite/parts/inc/partition_blocked_sql_funcs.inc
90 let $coltype = char(30);
91 --source suite/parts/inc/partition_blocked_sql_funcs.inc
93 let $sqlfunc = length(col1);
94 let $valsqlfunc = length(
'a,b,c,d,e,f,g,h,i');
96 --source suite/parts/inc/partition_blocked_sql_funcs.inc
98 let $sqlfunc = locate(
'a',col1);
99 let $valsqlfunc = locate(
'i',
'a,b,c,d,e,f,g,h,i');
101 --source suite/parts/inc/partition_blocked_sql_funcs.inc
102 let $coltype = char(30);
103 --source suite/parts/inc/partition_blocked_sql_funcs.inc
105 let $sqlfunc = octet_length(col1);
106 let $valsqlfunc = octet_length(
'a,b,c,d,e,f,g,h,i');
107 --source suite/parts/inc/partition_blocked_sql_funcs.inc
109 let $sqlfunc = position(
'a' in col1);
110 let $valsqlfunc = position(
'i' in
'a,b,c,d,e,f,g,h,i');
112 --source suite/parts/inc/partition_blocked_sql_funcs.inc
113 let $coltype = char(30);
114 --source suite/parts/inc/partition_blocked_sql_funcs.inc
116 let $sqlfunc = strcmp(col1,
'acb');
117 let $valsqlfunc = strcmp(
'i',
'a,b,c,d,e,f,g,h,i');
119 --source suite/parts/inc/partition_blocked_sql_funcs.inc
120 let $coltype = char(30);
121 --source suite/parts/inc/partition_blocked_sql_funcs.inc
123 let $sqlfunc = crc32(col1);
124 let $valsqlfunc = crc32(
'a,b,c,d,e,f,g,h,i');
125 let $coltype = char(30);
126 --source suite/parts/inc/partition_blocked_sql_funcs.inc
128 let $sqlfunc = round(col1);
129 let $valsqlfunc = round(15);
131 --source suite/parts/inc/partition_blocked_sql_funcs.inc
133 let $sqlfunc = sign(col1);
134 let $valsqlfunc = sign(123);
136 --source suite/parts/inc/partition_blocked_sql_funcs.inc
138 let $sqlfunc = period_add(col1,5);
139 let $valsqlfunc = period_add(9804,5);
140 let $coltype = datetime;
141 --source suite/parts/inc/partition_blocked_sql_funcs.inc
143 let $sqlfunc = period_diff(col1,col2);
144 let $valsqlfunc = period_diff(9809,199907);
145 let $coltype = datetime,col2 datetime;
146 --source suite/parts/inc/partition_blocked_sql_funcs.inc
147 let $coltype = int,col2 int;
148 --source suite/parts/inc/partition_blocked_sql_funcs.inc
150 let $sqlfunc = timestampdiff(day,5,col1);
151 let $valsqlfunc = timestampdiff(YEAR,
'2002-05-01',
'2001-01-01');
152 let $coltype = datetime;
153 --source suite/parts/inc/partition_blocked_sql_funcs.inc
155 ################################################################################
156 # After the fix for bug #42849 the server behavior does not fit into this test's
157 # architecture: for UNIX_TIMESTAMP() some of the queries in
158 # suite/parts/inc/partition_blocked_sql_funcs.inc will fail with a different
159 # error (ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR) and some will succeed where
160 ################################################################################
161 #let $sqlfunc = unix_timestamp(col1);
162 #let $valsqlfunc = unix_timestamp ('2002-05-01');
163 #let $coltype = date;
164 #--source suite/parts/inc/partition_blocked_sql_funcs.inc
166 let $sqlfunc = week(col1);
167 let $valsqlfunc = week(
'2002-05-01');
168 let $coltype = datetime;
169 --source suite/parts/inc/partition_blocked_sql_funcs.inc
171 let $sqlfunc = weekofyear(col1);
172 let $valsqlfunc = weekofyear(
'2002-05-01');
173 let $coltype = datetime;
174 --source suite/parts/inc/partition_blocked_sql_funcs.inc
176 let $sqlfunc = cast(col1 as
signed);
177 let $valsqlfunc = cast(123 as
signed);
178 let $coltype = varchar(30);
179 --source suite/parts/inc/partition_blocked_sql_funcs.inc
181 let $sqlfunc = convert(col1,
unsigned);
182 let $valsqlfunc = convert(123,
unsigned);
183 let $coltype = varchar(30);
184 --source suite/parts/inc/partition_blocked_sql_funcs.inc
186 let $sqlfunc = col1 | 20;
187 let $valsqlfunc = 10 | 20;
189 --source suite/parts/inc/partition_blocked_sql_funcs.inc
191 let $sqlfunc = col1 & 20;
192 let $valsqlfunc = 10 & 20;
194 --source suite/parts/inc/partition_blocked_sql_funcs.inc
196 let $sqlfunc = col1 ^ 20;
197 let $valsqlfunc = 10 ^ 20;
199 --source suite/parts/inc/partition_blocked_sql_funcs.inc
201 let $sqlfunc = col1 << 20;
202 let $valsqlfunc = 10 << 20;
204 --source suite/parts/inc/partition_blocked_sql_funcs.inc
206 let $sqlfunc = col1 >> 20;
207 let $valsqlfunc = 10 >> 20;
209 --source suite/parts/inc/partition_blocked_sql_funcs.inc
211 let $sqlfunc = ~col1;
212 let $valsqlfunc = ~20;
214 --source suite/parts/inc/partition_blocked_sql_funcs.inc
216 let $sqlfunc = bit_count(col1);
217 let $valsqlfunc = bit_count(20);
219 --source suite/parts/inc/partition_blocked_sql_funcs.inc
221 let $sqlfunc = inet_aton(col1);
222 let $valsqlfunc = inet_aton(
'192.168.1.1');
224 --source suite/parts/inc/partition_blocked_sql_funcs.inc
227 let $sqlfunc = bit_length(col1)+@var-@var;
228 let $valsqlfunc = bit_length(20)+@var-@var;
230 --source suite/parts/inc/partition_blocked_sql_funcs.inc
234 create
function getmaxsigned_t1(col
int) returns
int
236 declare done
int default 0;
241 declare
continue handler for sqlstate
'01000' set done = 1;
242 declare
continue handler for sqlstate
'02000' set done = 1;
246 wl_loop: WHILE NOT done DO
257 let $sqlfunc = getmaxsigned_t1(col1);
258 let $valsqlfunc = getmaxsigned(10);
260 --source suite/parts/inc/partition_blocked_sql_funcs.inc
261 drop
function if exists getmaxsigned_t1;