1
by brian
clean slate |
1 |
#
|
2 |
# This file contains tests covering the parser |
|
3 |
#
|
|
4 |
||
5 |
#============================================================================= |
|
6 |
# LEXICAL PARSER (lex) |
|
7 |
#============================================================================= |
|
8 |
||
9 |
SET @save_sql_mode=@@sql_mode; |
|
10 |
||
11 |
#
|
|
12 |
# Documenting the current behavior, to detect incompatible changes. |
|
13 |
# In each cases: |
|
14 |
# - no error is the correct result |
|
15 |
# - an error is the expected result with the current implementation, |
|
16 |
# and is a limitation. |
|
17 |
||
18 |
set SQL_MODE=''; |
|
19 |
||
20 |
create table ADDDATE(a int); |
|
21 |
drop table ADDDATE; |
|
22 |
create table ADDDATE (a int); |
|
23 |
drop table ADDDATE; |
|
24 |
||
25 |
--error ER_PARSE_ERROR |
|
26 |
create table BIT_AND(a int); |
|
27 |
create table BIT_AND (a int); |
|
28 |
drop table BIT_AND; |
|
29 |
||
30 |
--error ER_PARSE_ERROR |
|
31 |
create table BIT_OR(a int); |
|
32 |
create table BIT_OR (a int); |
|
33 |
drop table BIT_OR; |
|
34 |
||
35 |
--error ER_PARSE_ERROR |
|
36 |
create table BIT_XOR(a int); |
|
37 |
create table BIT_XOR (a int); |
|
38 |
drop table BIT_XOR; |
|
39 |
||
40 |
--error ER_PARSE_ERROR |
|
41 |
create table CAST(a int); |
|
42 |
create table CAST (a int); |
|
43 |
drop table CAST; |
|
44 |
||
45 |
--error ER_PARSE_ERROR |
|
46 |
create table COUNT(a int); |
|
47 |
create table COUNT (a int); |
|
48 |
drop table COUNT; |
|
49 |
||
50 |
--error ER_PARSE_ERROR |
|
51 |
create table CURDATE(a int); |
|
52 |
create table CURDATE (a int); |
|
53 |
drop table CURDATE; |
|
54 |
||
55 |
--error ER_PARSE_ERROR |
|
56 |
create table CURTIME(a int); |
|
57 |
create table CURTIME (a int); |
|
58 |
drop table CURTIME; |
|
59 |
||
60 |
--error ER_PARSE_ERROR |
|
61 |
create table DATE_ADD(a int); |
|
62 |
create table DATE_ADD (a int); |
|
63 |
drop table DATE_ADD; |
|
64 |
||
65 |
--error ER_PARSE_ERROR |
|
66 |
create table DATE_SUB(a int); |
|
67 |
create table DATE_SUB (a int); |
|
68 |
drop table DATE_SUB; |
|
69 |
||
70 |
--error ER_PARSE_ERROR |
|
71 |
create table EXTRACT(a int); |
|
72 |
create table EXTRACT (a int); |
|
73 |
drop table EXTRACT; |
|
74 |
||
75 |
--error ER_PARSE_ERROR |
|
76 |
create table GROUP_CONCAT(a int); |
|
77 |
create table GROUP_CONCAT (a int); |
|
78 |
drop table GROUP_CONCAT; |
|
79 |
||
80 |
# Limitation removed in 5.1 |
|
81 |
create table GROUP_UNIQUE_USERS(a int); |
|
82 |
drop table GROUP_UNIQUE_USERS; |
|
83 |
create table GROUP_UNIQUE_USERS (a int); |
|
84 |
drop table GROUP_UNIQUE_USERS; |
|
85 |
||
86 |
--error ER_PARSE_ERROR |
|
87 |
create table MAX(a int); |
|
88 |
create table MAX (a int); |
|
89 |
drop table MAX; |
|
90 |
||
91 |
--error ER_PARSE_ERROR |
|
92 |
create table MID(a int); |
|
93 |
create table MID (a int); |
|
94 |
drop table MID; |
|
95 |
||
96 |
--error ER_PARSE_ERROR |
|
97 |
create table MIN(a int); |
|
98 |
create table MIN (a int); |
|
99 |
drop table MIN; |
|
100 |
||
101 |
--error ER_PARSE_ERROR |
|
102 |
create table NOW(a int); |
|
103 |
create table NOW (a int); |
|
104 |
drop table NOW; |
|
105 |
||
106 |
--error ER_PARSE_ERROR |
|
107 |
create table POSITION(a int); |
|
108 |
create table POSITION (a int); |
|
109 |
drop table POSITION; |
|
110 |
||
111 |
create table SESSION_USER(a int); |
|
112 |
drop table SESSION_USER; |
|
113 |
create table SESSION_USER (a int); |
|
114 |
drop table SESSION_USER; |
|
115 |
||
116 |
--error ER_PARSE_ERROR |
|
117 |
create table STD(a int); |
|
118 |
create table STD (a int); |
|
119 |
drop table STD; |
|
120 |
||
121 |
--error ER_PARSE_ERROR |
|
122 |
create table STDDEV(a int); |
|
123 |
create table STDDEV (a int); |
|
124 |
drop table STDDEV; |
|
125 |
||
126 |
--error ER_PARSE_ERROR |
|
127 |
create table STDDEV_POP(a int); |
|
128 |
create table STDDEV_POP (a int); |
|
129 |
drop table STDDEV_POP; |
|
130 |
||
131 |
--error ER_PARSE_ERROR |
|
132 |
create table STDDEV_SAMP(a int); |
|
133 |
create table STDDEV_SAMP (a int); |
|
134 |
drop table STDDEV_SAMP; |
|
135 |
||
136 |
create table SUBDATE(a int); |
|
137 |
drop table SUBDATE; |
|
138 |
create table SUBDATE (a int); |
|
139 |
drop table SUBDATE; |
|
140 |
||
141 |
--error ER_PARSE_ERROR |
|
142 |
create table SUBSTR(a int); |
|
143 |
create table SUBSTR (a int); |
|
144 |
drop table SUBSTR; |
|
145 |
||
146 |
--error ER_PARSE_ERROR |
|
147 |
create table SUBSTRING(a int); |
|
148 |
create table SUBSTRING (a int); |
|
149 |
drop table SUBSTRING; |
|
150 |
||
151 |
--error ER_PARSE_ERROR |
|
152 |
create table SUM(a int); |
|
153 |
create table SUM (a int); |
|
154 |
drop table SUM; |
|
155 |
||
156 |
--error ER_PARSE_ERROR |
|
157 |
create table SYSDATE(a int); |
|
158 |
create table SYSDATE (a int); |
|
159 |
drop table SYSDATE; |
|
160 |
||
161 |
create table SYSTEM_USER(a int); |
|
162 |
drop table SYSTEM_USER; |
|
163 |
create table SYSTEM_USER (a int); |
|
164 |
drop table SYSTEM_USER; |
|
165 |
||
166 |
--error ER_PARSE_ERROR |
|
167 |
create table TRIM(a int); |
|
168 |
create table TRIM (a int); |
|
169 |
drop table TRIM; |
|
170 |
||
171 |
# Limitation removed in 5.1 |
|
172 |
create table UNIQUE_USERS(a int); |
|
173 |
drop table UNIQUE_USERS; |
|
174 |
create table UNIQUE_USERS (a int); |
|
175 |
drop table UNIQUE_USERS; |
|
176 |
||
177 |
--error ER_PARSE_ERROR |
|
178 |
create table VARIANCE(a int); |
|
179 |
create table VARIANCE (a int); |
|
180 |
drop table VARIANCE; |
|
181 |
||
182 |
--error ER_PARSE_ERROR |
|
183 |
create table VAR_POP(a int); |
|
184 |
create table VAR_POP (a int); |
|
185 |
drop table VAR_POP; |
|
186 |
||
187 |
--error ER_PARSE_ERROR |
|
188 |
create table VAR_SAMP(a int); |
|
189 |
create table VAR_SAMP (a int); |
|
190 |
drop table VAR_SAMP; |
|
191 |
||
192 |
set SQL_MODE='IGNORE_SPACE'; |
|
193 |
||
194 |
create table ADDDATE(a int); |
|
195 |
drop table ADDDATE; |
|
196 |
create table ADDDATE (a int); |
|
197 |
drop table ADDDATE; |
|
198 |
||
199 |
--error ER_PARSE_ERROR |
|
200 |
create table BIT_AND(a int); |
|
201 |
--error ER_PARSE_ERROR |
|
202 |
create table BIT_AND (a int); |
|
203 |
||
204 |
--error ER_PARSE_ERROR |
|
205 |
create table BIT_OR(a int); |
|
206 |
--error ER_PARSE_ERROR |
|
207 |
create table BIT_OR (a int); |
|
208 |
||
209 |
--error ER_PARSE_ERROR |
|
210 |
create table BIT_XOR(a int); |
|
211 |
--error ER_PARSE_ERROR |
|
212 |
create table BIT_XOR (a int); |
|
213 |
||
214 |
--error ER_PARSE_ERROR |
|
215 |
create table CAST(a int); |
|
216 |
--error ER_PARSE_ERROR |
|
217 |
create table CAST (a int); |
|
218 |
||
219 |
--error ER_PARSE_ERROR |
|
220 |
create table COUNT(a int); |
|
221 |
--error ER_PARSE_ERROR |
|
222 |
create table COUNT (a int); |
|
223 |
||
224 |
--error ER_PARSE_ERROR |
|
225 |
create table CURDATE(a int); |
|
226 |
--error ER_PARSE_ERROR |
|
227 |
create table CURDATE (a int); |
|
228 |
||
229 |
--error ER_PARSE_ERROR |
|
230 |
create table CURTIME(a int); |
|
231 |
--error ER_PARSE_ERROR |
|
232 |
create table CURTIME (a int); |
|
233 |
||
234 |
--error ER_PARSE_ERROR |
|
235 |
create table DATE_ADD(a int); |
|
236 |
--error ER_PARSE_ERROR |
|
237 |
create table DATE_ADD (a int); |
|
238 |
||
239 |
--error ER_PARSE_ERROR |
|
240 |
create table DATE_SUB(a int); |
|
241 |
--error ER_PARSE_ERROR |
|
242 |
create table DATE_SUB (a int); |
|
243 |
||
244 |
--error ER_PARSE_ERROR |
|
245 |
create table EXTRACT(a int); |
|
246 |
--error ER_PARSE_ERROR |
|
247 |
create table EXTRACT (a int); |
|
248 |
||
249 |
--error ER_PARSE_ERROR |
|
250 |
create table GROUP_CONCAT(a int); |
|
251 |
--error ER_PARSE_ERROR |
|
252 |
create table GROUP_CONCAT (a int); |
|
253 |
||
254 |
# Limitation removed in 5.1 |
|
255 |
create table GROUP_UNIQUE_USERS(a int); |
|
256 |
drop table GROUP_UNIQUE_USERS; |
|
257 |
create table GROUP_UNIQUE_USERS (a int); |
|
258 |
drop table GROUP_UNIQUE_USERS; |
|
259 |
||
260 |
--error ER_PARSE_ERROR |
|
261 |
create table MAX(a int); |
|
262 |
--error ER_PARSE_ERROR |
|
263 |
create table MAX (a int); |
|
264 |
||
265 |
--error ER_PARSE_ERROR |
|
266 |
create table MID(a int); |
|
267 |
--error ER_PARSE_ERROR |
|
268 |
create table MID (a int); |
|
269 |
||
270 |
--error ER_PARSE_ERROR |
|
271 |
create table MIN(a int); |
|
272 |
--error ER_PARSE_ERROR |
|
273 |
create table MIN (a int); |
|
274 |
||
275 |
--error ER_PARSE_ERROR |
|
276 |
create table NOW(a int); |
|
277 |
--error ER_PARSE_ERROR |
|
278 |
create table NOW (a int); |
|
279 |
||
280 |
--error ER_PARSE_ERROR |
|
281 |
create table POSITION(a int); |
|
282 |
--error ER_PARSE_ERROR |
|
283 |
create table POSITION (a int); |
|
284 |
||
285 |
create table SESSION_USER(a int); |
|
286 |
drop table SESSION_USER; |
|
287 |
create table SESSION_USER (a int); |
|
288 |
drop table SESSION_USER; |
|
289 |
||
290 |
--error ER_PARSE_ERROR |
|
291 |
create table STD(a int); |
|
292 |
--error ER_PARSE_ERROR |
|
293 |
create table STD (a int); |
|
294 |
||
295 |
--error ER_PARSE_ERROR |
|
296 |
create table STDDEV(a int); |
|
297 |
--error ER_PARSE_ERROR |
|
298 |
create table STDDEV (a int); |
|
299 |
||
300 |
--error ER_PARSE_ERROR |
|
301 |
create table STDDEV_POP(a int); |
|
302 |
--error ER_PARSE_ERROR |
|
303 |
create table STDDEV_POP (a int); |
|
304 |
||
305 |
--error ER_PARSE_ERROR |
|
306 |
create table STDDEV_SAMP(a int); |
|
307 |
--error ER_PARSE_ERROR |
|
308 |
create table STDDEV_SAMP (a int); |
|
309 |
||
310 |
create table SUBDATE(a int); |
|
311 |
drop table SUBDATE; |
|
312 |
create table SUBDATE (a int); |
|
313 |
drop table SUBDATE; |
|
314 |
||
315 |
--error ER_PARSE_ERROR |
|
316 |
create table SUBSTR(a int); |
|
317 |
--error ER_PARSE_ERROR |
|
318 |
create table SUBSTR (a int); |
|
319 |
||
320 |
--error ER_PARSE_ERROR |
|
321 |
create table SUBSTRING(a int); |
|
322 |
--error ER_PARSE_ERROR |
|
323 |
create table SUBSTRING (a int); |
|
324 |
||
325 |
--error ER_PARSE_ERROR |
|
326 |
create table SUM(a int); |
|
327 |
--error ER_PARSE_ERROR |
|
328 |
create table SUM (a int); |
|
329 |
||
330 |
--error ER_PARSE_ERROR |
|
331 |
create table SYSDATE(a int); |
|
332 |
--error ER_PARSE_ERROR |
|
333 |
create table SYSDATE (a int); |
|
334 |
||
335 |
create table SYSTEM_USER(a int); |
|
336 |
drop table SYSTEM_USER; |
|
337 |
create table SYSTEM_USER (a int); |
|
338 |
drop table SYSTEM_USER; |
|
339 |
||
340 |
--error ER_PARSE_ERROR |
|
341 |
create table TRIM(a int); |
|
342 |
--error ER_PARSE_ERROR |
|
343 |
create table TRIM (a int); |
|
344 |
||
345 |
# Limitation removed in 5.1 |
|
346 |
create table UNIQUE_USERS(a int); |
|
347 |
drop table UNIQUE_USERS; |
|
348 |
create table UNIQUE_USERS (a int); |
|
349 |
drop table UNIQUE_USERS; |
|
350 |
||
351 |
--error ER_PARSE_ERROR |
|
352 |
create table VARIANCE(a int); |
|
353 |
--error ER_PARSE_ERROR |
|
354 |
create table VARIANCE (a int); |
|
355 |
||
356 |
--error ER_PARSE_ERROR |
|
357 |
create table VAR_POP(a int); |
|
358 |
--error ER_PARSE_ERROR |
|
359 |
create table VAR_POP (a int); |
|
360 |
||
361 |
--error ER_PARSE_ERROR |
|
362 |
create table VAR_SAMP(a int); |
|
363 |
--error ER_PARSE_ERROR |
|
364 |
create table VAR_SAMP (a int); |
|
365 |
||
366 |
#
|
|
367 |
# Bug#25930 (CREATE TABLE x SELECT ... parses columns wrong when ran with |
|
368 |
# ANSI_QUOTES mode) |
|
369 |
#
|
|
370 |
||
371 |
--disable_warnings |
|
372 |
DROP TABLE IF EXISTS table_25930_a; |
|
373 |
DROP TABLE IF EXISTS table_25930_b; |
|
374 |
--enable_warnings |
|
375 |
||
376 |
SET SQL_MODE = 'ANSI_QUOTES'; |
|
377 |
CREATE TABLE table_25930_a ( "blah" INT ); |
|
378 |
CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a; |
|
379 |
||
380 |
# The lexer used to chop the first <">, |
|
381 |
# not marking the start of the token "blah" correctly. |
|
382 |
desc table_25930_b;
|
|
383 |
||
384 |
DROP TABLE table_25930_a;
|
|
385 |
DROP TABLE table_25930_b;
|
|
386 |
||
387 |
||
388 |
SET @@sql_mode=@save_sql_mode;
|
|
389 |
||
390 |
#=============================================================================
|
|
391 |
# SYNTACTIC PARSER (bison)
|
|
392 |
#=============================================================================
|
|
393 |
||
394 |
#
|
|
395 |
#
|
|
396 |
# Bug#21114 (Foreign key creation fails to table with name format)
|
|
397 |
#
|
|
398 |
||
399 |
# Test coverage with edge conditions
|
|
400 |
||
401 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
402 |
select pi(3.14);
|
|
403 |
||
404 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
405 |
select tan();
|
|
406 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
407 |
select tan(1, 2);
|
|
408 |
||
409 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
410 |
select makedate(1);
|
|
411 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
412 |
select makedate(1, 2, 3);
|
|
413 |
||
414 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
415 |
select maketime();
|
|
416 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
417 |
select maketime(1);
|
|
418 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
419 |
select maketime(1, 2);
|
|
420 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
421 |
select maketime(1, 2, 3, 4);
|
|
422 |
||
423 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
424 |
select atan();
|
|
425 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
426 |
select atan2(1, 2, 3);
|
|
427 |
||
428 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
429 |
select concat();
|
|
430 |
select concat("foo"); |
|
431 |
||
432 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
433 |
select concat_ws();
|
|
434 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
435 |
select concat_ws("foo"); |
|
436 |
||
437 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
438 |
select encrypt();
|
|
439 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
440 |
select encrypt(1, 2, 3);
|
|
441 |
||
442 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
443 |
select des_encrypt("p1", "p2", "not expected"); |
|
444 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
445 |
select des_decrypt("p1", "p2", "not expected"); |
|
446 |
||
447 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
448 |
select elt();
|
|
449 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
450 |
select elt(1);
|
|
451 |
||
452 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
453 |
select export_set();
|
|
454 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
455 |
select export_set("p1"); |
|
456 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
457 |
select export_set("p1", "p2"); |
|
458 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
459 |
select export_set("p1", "p2", "p3", "p4", "p5", "p6"); |
|
460 |
||
461 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
462 |
select field();
|
|
463 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
464 |
select field("p1"); |
|
465 |
||
466 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
467 |
select from_unixtime();
|
|
468 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
469 |
select from_unixtime(1, 2, 3);
|
|
470 |
||
471 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
472 |
select unix_timestamp(1, 2);
|
|
473 |
||
474 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
475 |
select greatest();
|
|
476 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
477 |
select greatest(12);
|
|
478 |
||
479 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
480 |
select last_insert_id(1, 2);
|
|
481 |
||
482 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
483 |
select least();
|
|
484 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
485 |
select least(12);
|
|
486 |
||
487 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
488 |
select locate();
|
|
489 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
490 |
select locate(1);
|
|
491 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
492 |
select locate(1, 2, 3, 4);
|
|
493 |
||
494 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
495 |
select log();
|
|
496 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
497 |
select log(1, 2, 3);
|
|
498 |
||
499 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
500 |
select make_set();
|
|
501 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
502 |
select make_set(1);
|
|
503 |
||
504 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
505 |
select master_pos_wait();
|
|
506 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
507 |
select master_pos_wait(1);
|
|
508 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
509 |
select master_pos_wait(1, 2, 3, 4);
|
|
510 |
||
511 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
512 |
select rand(1, 2, 3);
|
|
513 |
||
514 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
515 |
select round(1, 2, 3);
|
|
516 |
||
517 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
518 |
select yearweek();
|
|
519 |
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
|
|
520 |
select yearweek(1, 2, 3);
|
|
521 |
||
522 |
#
|
|
523 |
# Bug#24736: UDF functions parsed as Stored Functions
|
|
524 |
#
|
|
525 |
||
526 |
# Verify that the syntax for calling UDF : foo(expr AS param, ...)
|
|
527 |
# can not be used when calling native functions
|
|
528 |
||
529 |
# Native function with 1 argument
|
|
530 |
||
531 |
select abs(3);
|
|
532 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
533 |
select abs(3 AS three);
|
|
534 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
535 |
select abs(3 three);
|
|
536 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
537 |
select abs(3 AS "three"); |
|
538 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
539 |
select abs(3 "three"); |
|
540 |
||
541 |
# Native function with 2 arguments
|
|
542 |
||
543 |
set @bar="bar"; |
|
544 |
set @foobar="foobar"; |
|
545 |
||
546 |
select instr("foobar", "bar"); |
|
547 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
548 |
select instr("foobar" AS p1, "bar"); |
|
549 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
550 |
select instr("foobar" p1, "bar"); |
|
551 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
552 |
select instr("foobar" AS "p1", "bar"); |
|
553 |
## String concatenation, valid syntax
|
|
554 |
select instr("foobar" "p1", "bar"); |
|
555 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
556 |
select instr(@foobar "p1", "bar"); |
|
557 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
558 |
select instr("foobar", "bar" AS p2); |
|
559 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
560 |
select instr("foobar", "bar" p2); |
|
561 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
562 |
select instr("foobar", "bar" AS "p2"); |
|
563 |
## String concatenation, valid syntax
|
|
564 |
select instr("foobar", "bar" "p2"); |
|
565 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
566 |
select instr("foobar", @bar "p2"); |
|
567 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
568 |
select instr("foobar" AS p1, "bar" AS p2); |
|
569 |
||
570 |
# Native function with 3 arguments
|
|
571 |
||
572 |
select conv(255, 10, 16);
|
|
573 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
574 |
select conv(255 AS p1, 10, 16);
|
|
575 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
576 |
select conv(255 p1, 10, 16);
|
|
577 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
578 |
select conv(255 AS "p1", 10, 16); |
|
579 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
580 |
select conv(255 "p1", 10, 16); |
|
581 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
582 |
select conv(255, 10 AS p2, 16);
|
|
583 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
584 |
select conv(255, 10 p2, 16);
|
|
585 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
586 |
select conv(255, 10 AS "p2", 16); |
|
587 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
588 |
select conv(255, 10 "p2", 16); |
|
589 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
590 |
select conv(255, 10, 16 AS p3);
|
|
591 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
592 |
select conv(255, 10, 16 p3);
|
|
593 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
594 |
select conv(255, 10, 16 AS "p3"); |
|
595 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
596 |
select conv(255, 10, 16 "p3"); |
|
597 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
598 |
select conv(255 AS p1, 10 AS p2, 16 AS p3);
|
|
599 |
||
600 |
# Native function with a variable number of arguments
|
|
601 |
||
602 |
# Bug in libm.so on Solaris:
|
|
603 |
# atan(10) from 32-bit version returns 1.4711276743037347
|
|
604 |
# atan(10) from 64-bit version returns 1.4711276743037345
|
|
605 |
--replace_result 1.4711276743037345 1.4711276743037347
|
|
606 |
select atan(10);
|
|
607 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
608 |
select atan(10 AS p1);
|
|
609 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
610 |
select atan(10 p1);
|
|
611 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
612 |
select atan(10 AS "p1"); |
|
613 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
614 |
select atan(10 "p1"); |
|
615 |
||
616 |
select atan(10, 20);
|
|
617 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
618 |
select atan(10 AS p1, 20);
|
|
619 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
620 |
select atan(10 p1, 20);
|
|
621 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
622 |
select atan(10 AS "p1", 20); |
|
623 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
624 |
select atan(10 "p1", 20); |
|
625 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
626 |
select atan(10, 20 AS p2);
|
|
627 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
628 |
select atan(10, 20 p2);
|
|
629 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
630 |
select atan(10, 20 AS "p2"); |
|
631 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
632 |
select atan(10, 20 "p2"); |
|
633 |
-- error ER_WRONG_PARAMETERS_TO_NATIVE_FCT
|
|
634 |
select atan(10 AS p1, 20 AS p2);
|
|
635 |
||
636 |
#
|
|
637 |
# Bug#22312 Syntax error in expression with INTERVAL()
|
|
638 |
#
|
|
639 |
||
640 |
--disable_warnings
|
|
641 |
DROP TABLE IF EXISTS t1;
|
|
642 |
--enable_warnings
|
|
643 |
||
644 |
SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
|
|
645 |
SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE;
|
|
646 |
SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND; |
|
647 |
SELECT 1 + INTERVAL(1,0,1,2) + 1;
|
|
648 |
SELECT INTERVAL(1^1,0,1,2) + 1;
|
|
649 |
SELECT INTERVAL(1,0+1,2,3) * 5.5;
|
|
650 |
SELECT INTERVAL(3,3,1+3,4+4) / 0.5;
|
|
651 |
SELECT (INTERVAL(1,0,1,2) + 5) * 7 + INTERVAL(1,0,1,2) / 2;
|
|
652 |
SELECT INTERVAL(1,0,1,2) + 1, 5 * INTERVAL(1,0,1,2);
|
|
653 |
SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3);
|
|
654 |
||
655 |
--disable_warnings
|
|
656 |
SELECT 1^1 + INTERVAL 1+1 SECOND & 1 + INTERVAL 1+1 SECOND;
|
|
657 |
SELECT 1%2 - INTERVAL 1^1 SECOND | 1%2 - INTERVAL 1^1 SECOND;
|
|
658 |
--enable_warnings
|
|
659 |
||
660 |
CREATE TABLE t1 (a INT, b DATETIME);
|
|
661 |
INSERT INTO t1 VALUES (INTERVAL(3,2,1) + 1, "1997-12-31 23:59:59" + INTERVAL 1 SECOND); |
|
662 |
SELECT * FROM t1 WHERE a = INTERVAL(3,2,1) + 1; |
|
663 |
DROP TABLE t1; |
|
664 |
||
665 |
#
|
|
666 |
# Bug#28317 Left Outer Join with {oj outer-join} |
|
667 |
#
|
|
668 |
||
669 |
--disable_warnings |
|
670 |
DROP TABLE IF EXISTS t1,t2,t3; |
|
671 |
--enable_warnings |
|
672 |
CREATE TABLE t1 (a1 INT, a2 INT, a3 INT, a4 DATETIME); |
|
673 |
CREATE TABLE t2 LIKE t1; |
|
674 |
CREATE TABLE t3 LIKE t1; |
|
675 |
SELECT t1.* FROM t1 AS t0, { OJ t2 INNER JOIN t1 ON (t1.a1=t2.a1) } WHERE t0.a3=2; |
|
676 |
SELECT t1.*,t2.* FROM { OJ ((t1 INNER JOIN t2 ON (t1.a1=t2.a2)) LEFT OUTER JOIN t3 ON t3.a3=t2.a1)}; |
|
677 |
SELECT t1.*,t2.* FROM { OJ ((t1 LEFT OUTER JOIN t2 ON t1.a3=t2.a2) INNER JOIN t3 ON (t3.a1=t2.a2))}; |
|
678 |
SELECT t1.*,t2.* FROM { OJ (t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a2) CROSS JOIN t3 ON (t3.a2=t2.a3)}; |
|
679 |
SELECT * FROM {oj t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a3} WHERE t1.a2 > 10; |
|
680 |
SELECT {fn CONCAT(a1,a2)} FROM t1; |
|
681 |
UPDATE t3 SET a4={d '1789-07-14'} WHERE a1=0; |
|
682 |
SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')}; |
|
683 |
DROP TABLE t1, t2, t3; |
|
684 |
||
685 |
#
|
|
686 |
# Bug#31765 (BACKUP DATABASE broken syntax) |
|
687 |
#
|
|
688 |
||
689 |
--error ER_PARSE_ERROR |
|
690 |
BACKUP DATABASE *, test to 'broken.bak'; |
|
691 |
||
692 |
--error ER_PARSE_ERROR |
|
693 |
BACKUP DATABASE *, db1, db2, db3 to 'broken.bak'; |
|
694 |