~drizzle-trunk/drizzle/development

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