1SET @save_sql_mode=@@sql_mode;
2set SQL_MODE='';
3create table ADDDATE(a int);
4drop table ADDDATE;
5create table ADDDATE (a int);
6drop table ADDDATE;
7create table BIT_AND(a int);
8ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_AND(a int)' at line 1
9create table BIT_AND (a int);
10drop table BIT_AND;
11create table BIT_OR(a int);
12ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_OR(a int)' at line 1
13create table BIT_OR (a int);
14drop table BIT_OR;
15create table BIT_XOR(a int);
16ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_XOR(a int)' at line 1
17create table BIT_XOR (a int);
18drop table BIT_XOR;
19create table CAST(a int);
20ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CAST(a int)' at line 1
21create table CAST (a int);
22drop table CAST;
23create table COUNT(a int);
24ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COUNT(a int)' at line 1
25create table COUNT (a int);
26drop table COUNT;
27create table CURDATE(a int);
28ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURDATE(a int)' at line 1
29create table CURDATE (a int);
30drop table CURDATE;
31create table CURTIME(a int);
32ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURTIME(a int)' at line 1
33create table CURTIME (a int);
34drop table CURTIME;
35create table DATE_ADD(a int);
36ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_ADD(a int)' at line 1
37create table DATE_ADD (a int);
38drop table DATE_ADD;
39create table DATE_SUB(a int);
40ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_SUB(a int)' at line 1
41create table DATE_SUB (a int);
42drop table DATE_SUB;
43create table EXTRACT(a int);
44ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXTRACT(a int)' at line 1
45create table EXTRACT (a int);
46drop table EXTRACT;
47create table GROUP_CONCAT(a int);
48ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP_CONCAT(a int)' at line 1
49create table GROUP_CONCAT (a int);
50drop table GROUP_CONCAT;
51create table GROUP_UNIQUE_USERS(a int);
52drop table GROUP_UNIQUE_USERS;
53create table GROUP_UNIQUE_USERS (a int);
54drop table GROUP_UNIQUE_USERS;
55create table MAX(a int);
56ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MAX(a int)' at line 1
57create table MAX (a int);
58drop table MAX;
59create table MID(a int);
60ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MID(a int)' at line 1
61create table MID (a int);
62drop table MID;
63create table MIN(a int);
64ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MIN(a int)' at line 1
65create table MIN (a int);
66drop table MIN;
67create table NOW(a int);
68ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOW(a int)' at line 1
69create table NOW (a int);
70drop table NOW;
71create table POSITION(a int);
72ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'POSITION(a int)' at line 1
73create table POSITION (a int);
74drop table POSITION;
75create table SESSION_USER(a int);
76drop table SESSION_USER;
77create table SESSION_USER (a int);
78drop table SESSION_USER;
79create table STD(a int);
80ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STD(a int)' at line 1
81create table STD (a int);
82drop table STD;
83create table STDDEV(a int);
84ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV(a int)' at line 1
85create table STDDEV (a int);
86drop table STDDEV;
87create table STDDEV_POP(a int);
88ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_POP(a int)' at line 1
89create table STDDEV_POP (a int);
90drop table STDDEV_POP;
91create table STDDEV_SAMP(a int);
92ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_SAMP(a int)' at line 1
93create table STDDEV_SAMP (a int);
94drop table STDDEV_SAMP;
95create table SUBDATE(a int);
96drop table SUBDATE;
97create table SUBDATE (a int);
98drop table SUBDATE;
99create table SUBSTR(a int);
100ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTR(a int)' at line 1
101create table SUBSTR (a int);
102drop table SUBSTR;
103create table SUBSTRING(a int);
104ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTRING(a int)' at line 1
105create table SUBSTRING (a int);
106drop table SUBSTRING;
107create table SUM(a int);
108ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUM(a int)' at line 1
109create table SUM (a int);
110drop table SUM;
111create table SYSDATE(a int);
112ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SYSDATE(a int)' at line 1
113create table SYSDATE (a int);
114drop table SYSDATE;
115create table SYSTEM_USER(a int);
116drop table SYSTEM_USER;
117create table SYSTEM_USER (a int);
118drop table SYSTEM_USER;
119create table TRIM(a int);
120ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TRIM(a int)' at line 1
121create table TRIM (a int);
122drop table TRIM;
123create table UNIQUE_USERS(a int);
124drop table UNIQUE_USERS;
125create table UNIQUE_USERS (a int);
126drop table UNIQUE_USERS;
127create table VARIANCE(a int);
128ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VARIANCE(a int)' at line 1
129create table VARIANCE (a int);
130drop table VARIANCE;
131create table VAR_POP(a int);
132ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_POP(a int)' at line 1
133create table VAR_POP (a int);
134drop table VAR_POP;
135create table VAR_SAMP(a int);
136ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
137create table VAR_SAMP (a int);
138drop table VAR_SAMP;
139set SQL_MODE='IGNORE_SPACE';
140create table ADDDATE(a int);
141drop table ADDDATE;
142create table ADDDATE (a int);
143drop table ADDDATE;
144create table BIT_AND(a int);
145ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_AND(a int)' at line 1
146create table BIT_AND (a int);
147ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_AND (a int)' at line 1
148create table BIT_OR(a int);
149ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_OR(a int)' at line 1
150create table BIT_OR (a int);
151ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_OR (a int)' at line 1
152create table BIT_XOR(a int);
153ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_XOR(a int)' at line 1
154create table BIT_XOR (a int);
155ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'BIT_XOR (a int)' at line 1
156create table CAST(a int);
157ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CAST(a int)' at line 1
158create table CAST (a int);
159ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CAST (a int)' at line 1
160create table COUNT(a int);
161ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COUNT(a int)' at line 1
162create table COUNT (a int);
163ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COUNT (a int)' at line 1
164create table CURDATE(a int);
165ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURDATE(a int)' at line 1
166create table CURDATE (a int);
167ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURDATE (a int)' at line 1
168create table CURTIME(a int);
169ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURTIME(a int)' at line 1
170create table CURTIME (a int);
171ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CURTIME (a int)' at line 1
172create table DATE_ADD(a int);
173ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_ADD(a int)' at line 1
174create table DATE_ADD (a int);
175ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_ADD (a int)' at line 1
176create table DATE_SUB(a int);
177ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_SUB(a int)' at line 1
178create table DATE_SUB (a int);
179ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE_SUB (a int)' at line 1
180create table EXTRACT(a int);
181ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXTRACT(a int)' at line 1
182create table EXTRACT (a int);
183ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXTRACT (a int)' at line 1
184create table GROUP_CONCAT(a int);
185ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP_CONCAT(a int)' at line 1
186create table GROUP_CONCAT (a int);
187ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP_CONCAT (a int)' at line 1
188create table GROUP_UNIQUE_USERS(a int);
189drop table GROUP_UNIQUE_USERS;
190create table GROUP_UNIQUE_USERS (a int);
191drop table GROUP_UNIQUE_USERS;
192create table MAX(a int);
193ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MAX(a int)' at line 1
194create table MAX (a int);
195ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MAX (a int)' at line 1
196create table MID(a int);
197ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MID(a int)' at line 1
198create table MID (a int);
199ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MID (a int)' at line 1
200create table MIN(a int);
201ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MIN(a int)' at line 1
202create table MIN (a int);
203ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'MIN (a int)' at line 1
204create table NOW(a int);
205ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOW(a int)' at line 1
206create table NOW (a int);
207ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOW (a int)' at line 1
208create table POSITION(a int);
209ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'POSITION(a int)' at line 1
210create table POSITION (a int);
211ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'POSITION (a int)' at line 1
212create table SESSION_USER(a int);
213drop table SESSION_USER;
214create table SESSION_USER (a int);
215drop table SESSION_USER;
216create table STD(a int);
217ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STD(a int)' at line 1
218create table STD (a int);
219ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STD (a int)' at line 1
220create table STDDEV(a int);
221ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV(a int)' at line 1
222create table STDDEV (a int);
223ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV (a int)' at line 1
224create table STDDEV_POP(a int);
225ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_POP(a int)' at line 1
226create table STDDEV_POP (a int);
227ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_POP (a int)' at line 1
228create table STDDEV_SAMP(a int);
229ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_SAMP(a int)' at line 1
230create table STDDEV_SAMP (a int);
231ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'STDDEV_SAMP (a int)' at line 1
232create table SUBDATE(a int);
233drop table SUBDATE;
234create table SUBDATE (a int);
235drop table SUBDATE;
236create table SUBSTR(a int);
237ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTR(a int)' at line 1
238create table SUBSTR (a int);
239ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTR (a int)' at line 1
240create table SUBSTRING(a int);
241ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTRING(a int)' at line 1
242create table SUBSTRING (a int);
243ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUBSTRING (a int)' at line 1
244create table SUM(a int);
245ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUM(a int)' at line 1
246create table SUM (a int);
247ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SUM (a int)' at line 1
248create table SYSDATE(a int);
249ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SYSDATE(a int)' at line 1
250create table SYSDATE (a int);
251ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SYSDATE (a int)' at line 1
252create table SYSTEM_USER(a int);
253drop table SYSTEM_USER;
254create table SYSTEM_USER (a int);
255drop table SYSTEM_USER;
256create table TRIM(a int);
257ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TRIM(a int)' at line 1
258create table TRIM (a int);
259ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TRIM (a int)' at line 1
260create table UNIQUE_USERS(a int);
261drop table UNIQUE_USERS;
262create table UNIQUE_USERS (a int);
263drop table UNIQUE_USERS;
264create table VARIANCE(a int);
265ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VARIANCE(a int)' at line 1
266create table VARIANCE (a int);
267ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VARIANCE (a int)' at line 1
268create table VAR_POP(a int);
269ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_POP(a int)' at line 1
270create table VAR_POP (a int);
271ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_POP (a int)' at line 1
272create table VAR_SAMP(a int);
273ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
274create table VAR_SAMP (a int);
275ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'VAR_SAMP (a int)' at line 1
276DROP TABLE IF EXISTS table_25930_a;
277DROP TABLE IF EXISTS table_25930_b;
278SET SQL_MODE = 'ANSI_QUOTES';
279CREATE TABLE table_25930_a ( "blah" INT );
280CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
281desc table_25930_b;
282Field	Type	Null	Key	Default	Extra
283"blah" - 1	bigint(12)	YES		NULL
284DROP TABLE table_25930_a;
285DROP TABLE table_25930_b;
286SET @@sql_mode=@save_sql_mode;
287DROP PROCEDURE IF EXISTS p26030;
288select "non terminated"$$
289non terminated
290non terminated
291select "terminated";$$
292terminated
293terminated
294select "non terminated, space"      $$
295non terminated, space
296non terminated, space
297select "terminated, space";      $$
298terminated, space
299terminated, space
300select "non terminated, comment" /* comment */$$
301non terminated, comment
302non terminated, comment
303select "terminated, comment"; /* comment */$$
304terminated, comment
305terminated, comment
306select "stmt 1";select "stmt 2 non terminated"$$
307stmt 1
308stmt 1
309stmt 2 non terminated
310stmt 2 non terminated
311select "stmt 1";select "stmt 2 terminated";$$
312stmt 1
313stmt 1
314stmt 2 terminated
315stmt 2 terminated
316select "stmt 1";select "stmt 2 non terminated, space"      $$
317stmt 1
318stmt 1
319stmt 2 non terminated, space
320stmt 2 non terminated, space
321select "stmt 1";select "stmt 2 terminated, space";      $$
322stmt 1
323stmt 1
324stmt 2 terminated, space
325stmt 2 terminated, space
326select "stmt 1";select "stmt 2 non terminated, comment" /* comment */$$
327stmt 1
328stmt 1
329stmt 2 non terminated, comment
330stmt 2 non terminated, comment
331select "stmt 1";select "stmt 2 terminated, comment"; /* comment */$$
332stmt 1
333stmt 1
334stmt 2 terminated, comment
335stmt 2 terminated, comment
336select "stmt 1";             select "space, stmt 2"$$
337stmt 1
338stmt 1
339space, stmt 2
340space, stmt 2
341select "stmt 1";/* comment */select "comment, stmt 2"$$
342stmt 1
343stmt 1
344comment, stmt 2
345comment, stmt 2
346DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() BEGIN SELECT 1; END; CALL p26030()
347$$
3481
3491
350DROP PROCEDURE IF EXISTS p26030; CREATE PROCEDURE p26030() SELECT 1; CALL p26030()
351$$
3521
3531
354DROP PROCEDURE p26030;
355select pi(3.14);
356ERROR 42000: Incorrect parameter count in the call to native function 'pi'
357select tan();
358ERROR 42000: Incorrect parameter count in the call to native function 'tan'
359select tan(1, 2);
360ERROR 42000: Incorrect parameter count in the call to native function 'tan'
361select makedate(1);
362ERROR 42000: Incorrect parameter count in the call to native function 'makedate'
363select makedate(1, 2, 3);
364ERROR 42000: Incorrect parameter count in the call to native function 'makedate'
365select maketime();
366ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
367select maketime(1);
368ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
369select maketime(1, 2);
370ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
371select maketime(1, 2, 3, 4);
372ERROR 42000: Incorrect parameter count in the call to native function 'maketime'
373select atan();
374ERROR 42000: Incorrect parameter count in the call to native function 'atan'
375select atan2(1, 2, 3);
376ERROR 42000: Incorrect parameter count in the call to native function 'atan2'
377select concat();
378ERROR 42000: Incorrect parameter count in the call to native function 'concat'
379select concat("foo");
380concat("foo")
381foo
382select concat_ws();
383ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
384select concat_ws("foo");
385ERROR 42000: Incorrect parameter count in the call to native function 'concat_ws'
386select encrypt();
387ERROR 42000: Incorrect parameter count in the call to native function 'encrypt'
388select encrypt(1, 2, 3);
389ERROR 42000: Incorrect parameter count in the call to native function 'encrypt'
390select des_encrypt("p1", "p2", "not expected");
391ERROR 42000: Incorrect parameter count in the call to native function 'des_encrypt'
392select des_decrypt("p1", "p2", "not expected");
393ERROR 42000: Incorrect parameter count in the call to native function 'des_decrypt'
394select elt();
395ERROR 42000: Incorrect parameter count in the call to native function 'elt'
396select elt(1);
397ERROR 42000: Incorrect parameter count in the call to native function 'elt'
398select export_set();
399ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
400select export_set("p1");
401ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
402select export_set("p1", "p2");
403ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
404select export_set("p1", "p2", "p3", "p4", "p5", "p6");
405ERROR 42000: Incorrect parameter count in the call to native function 'export_set'
406select field();
407ERROR 42000: Incorrect parameter count in the call to native function 'field'
408select field("p1");
409ERROR 42000: Incorrect parameter count in the call to native function 'field'
410select from_unixtime();
411ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime'
412select from_unixtime(1, 2, 3);
413ERROR 42000: Incorrect parameter count in the call to native function 'from_unixtime'
414select unix_timestamp(1, 2);
415ERROR 42000: Incorrect parameter count in the call to native function 'unix_timestamp'
416select greatest();
417ERROR 42000: Incorrect parameter count in the call to native function 'greatest'
418select greatest(12);
419ERROR 42000: Incorrect parameter count in the call to native function 'greatest'
420select last_insert_id(1, 2);
421ERROR 42000: Incorrect parameter count in the call to native function 'last_insert_id'
422select least();
423ERROR 42000: Incorrect parameter count in the call to native function 'least'
424select least(12);
425ERROR 42000: Incorrect parameter count in the call to native function 'least'
426select locate();
427ERROR 42000: Incorrect parameter count in the call to native function 'locate'
428select locate(1);
429ERROR 42000: Incorrect parameter count in the call to native function 'locate'
430select locate(1, 2, 3, 4);
431ERROR 42000: Incorrect parameter count in the call to native function 'locate'
432select log();
433ERROR 42000: Incorrect parameter count in the call to native function 'log'
434select log(1, 2, 3);
435ERROR 42000: Incorrect parameter count in the call to native function 'log'
436select make_set();
437ERROR 42000: Incorrect parameter count in the call to native function 'make_set'
438select make_set(1);
439ERROR 42000: Incorrect parameter count in the call to native function 'make_set'
440select master_pos_wait();
441ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
442select master_pos_wait(1);
443ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
444select master_pos_wait(1, 2, 3, 4, 5);
445ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
446select rand(1, 2, 3);
447ERROR 42000: Incorrect parameter count in the call to native function 'rand'
448select round(1, 2, 3);
449ERROR 42000: Incorrect parameter count in the call to native function 'round'
450select yearweek();
451ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
452select yearweek(1, 2, 3);
453ERROR 42000: Incorrect parameter count in the call to native function 'yearweek'
454select abs(3);
455abs(3)
4563
457select abs(3 AS three);
458ERROR 42000: Incorrect parameters in the call to native function 'abs'
459select abs(3 three);
460ERROR 42000: Incorrect parameters in the call to native function 'abs'
461select abs(3 AS "three");
462ERROR 42000: Incorrect parameters in the call to native function 'abs'
463select abs(3 "three");
464ERROR 42000: Incorrect parameters in the call to native function 'abs'
465set @bar="bar";
466set @foobar="foobar";
467select instr("foobar", "bar");
468instr("foobar", "bar")
4694
470select instr("foobar" AS p1, "bar");
471ERROR 42000: Incorrect parameters in the call to native function 'instr'
472select instr("foobar" p1, "bar");
473ERROR 42000: Incorrect parameters in the call to native function 'instr'
474select instr("foobar" AS "p1", "bar");
475ERROR 42000: Incorrect parameters in the call to native function 'instr'
476select instr("foobar" "p1", "bar");
477instr("foobar" "p1", "bar")
4784
479select instr(@foobar "p1", "bar");
480ERROR 42000: Incorrect parameters in the call to native function 'instr'
481select instr("foobar", "bar" AS p2);
482ERROR 42000: Incorrect parameters in the call to native function 'instr'
483select instr("foobar", "bar" p2);
484ERROR 42000: Incorrect parameters in the call to native function 'instr'
485select instr("foobar", "bar" AS "p2");
486ERROR 42000: Incorrect parameters in the call to native function 'instr'
487select instr("foobar", "bar" "p2");
488instr("foobar", "bar" "p2")
4890
490select instr("foobar", @bar "p2");
491ERROR 42000: Incorrect parameters in the call to native function 'instr'
492select instr("foobar" AS p1, "bar" AS p2);
493ERROR 42000: Incorrect parameters in the call to native function 'instr'
494select conv(255, 10, 16);
495conv(255, 10, 16)
496FF
497select conv(255 AS p1, 10, 16);
498ERROR 42000: Incorrect parameters in the call to native function 'conv'
499select conv(255 p1, 10, 16);
500ERROR 42000: Incorrect parameters in the call to native function 'conv'
501select conv(255 AS "p1", 10, 16);
502ERROR 42000: Incorrect parameters in the call to native function 'conv'
503select conv(255 "p1", 10, 16);
504ERROR 42000: Incorrect parameters in the call to native function 'conv'
505select conv(255, 10 AS p2, 16);
506ERROR 42000: Incorrect parameters in the call to native function 'conv'
507select conv(255, 10 p2, 16);
508ERROR 42000: Incorrect parameters in the call to native function 'conv'
509select conv(255, 10 AS "p2", 16);
510ERROR 42000: Incorrect parameters in the call to native function 'conv'
511select conv(255, 10 "p2", 16);
512ERROR 42000: Incorrect parameters in the call to native function 'conv'
513select conv(255, 10, 16 AS p3);
514ERROR 42000: Incorrect parameters in the call to native function 'conv'
515select conv(255, 10, 16 p3);
516ERROR 42000: Incorrect parameters in the call to native function 'conv'
517select conv(255, 10, 16 AS "p3");
518ERROR 42000: Incorrect parameters in the call to native function 'conv'
519select conv(255, 10, 16 "p3");
520ERROR 42000: Incorrect parameters in the call to native function 'conv'
521select conv(255 AS p1, 10 AS p2, 16 AS p3);
522ERROR 42000: Incorrect parameters in the call to native function 'conv'
523select atan(10);
524atan(10)
5251.4711276743037347
526select atan(10 AS p1);
527ERROR 42000: Incorrect parameters in the call to native function 'atan'
528select atan(10 p1);
529ERROR 42000: Incorrect parameters in the call to native function 'atan'
530select atan(10 AS "p1");
531ERROR 42000: Incorrect parameters in the call to native function 'atan'
532select atan(10 "p1");
533ERROR 42000: Incorrect parameters in the call to native function 'atan'
534select atan(10, 20);
535atan(10, 20)
5360.4636476090008061
537select atan(10 AS p1, 20);
538ERROR 42000: Incorrect parameters in the call to native function 'atan'
539select atan(10 p1, 20);
540ERROR 42000: Incorrect parameters in the call to native function 'atan'
541select atan(10 AS "p1", 20);
542ERROR 42000: Incorrect parameters in the call to native function 'atan'
543select atan(10 "p1", 20);
544ERROR 42000: Incorrect parameters in the call to native function 'atan'
545select atan(10, 20 AS p2);
546ERROR 42000: Incorrect parameters in the call to native function 'atan'
547select atan(10, 20 p2);
548ERROR 42000: Incorrect parameters in the call to native function 'atan'
549select atan(10, 20 AS "p2");
550ERROR 42000: Incorrect parameters in the call to native function 'atan'
551select atan(10, 20 "p2");
552ERROR 42000: Incorrect parameters in the call to native function 'atan'
553select atan(10 AS p1, 20 AS p2);
554ERROR 42000: Incorrect parameters in the call to native function 'atan'
555DROP TABLE IF EXISTS t1;
556SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE;
557STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL 10 MINUTE
55822:10:00
559SELECT STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE;
560STR_TO_DATE('10:00 PM', '%h:%i %p') + INTERVAL (INTERVAL(1,2,3) + 1) MINUTE
56122:01:00
562SELECT "1997-12-31 23:59:59" + INTERVAL 1 SECOND;
563"1997-12-31 23:59:59" + INTERVAL 1 SECOND
5641998-01-01 00:00:00
565SELECT 1 + INTERVAL(1,0,1,2) + 1;
5661 + INTERVAL(1,0,1,2) + 1
5674
568SELECT INTERVAL(1^1,0,1,2) + 1;
569INTERVAL(1^1,0,1,2) + 1
5702
571SELECT INTERVAL(1,0+1,2,3) * 5.5;
572INTERVAL(1,0+1,2,3) * 5.5
5735.5
574SELECT INTERVAL(3,3,1+3,4+4) / 0.5;
575INTERVAL(3,3,1+3,4+4) / 0.5
5762.0000
577SELECT (INTERVAL(1,0,1,2) + 5) * 7 + INTERVAL(1,0,1,2) / 2;
578(INTERVAL(1,0,1,2) + 5) * 7 + INTERVAL(1,0,1,2) / 2
57950.0000
580SELECT INTERVAL(1,0,1,2) + 1, 5 * INTERVAL(1,0,1,2);
581INTERVAL(1,0,1,2) + 1	5 * INTERVAL(1,0,1,2)
5823	10
583SELECT INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3);
584INTERVAL(0,(1*5)/2) + INTERVAL(5,4,3)
5852
586SELECT 1^1 + INTERVAL 1+1 SECOND & 1 + INTERVAL 1+1 SECOND;
5871^1 + INTERVAL 1+1 SECOND & 1 + INTERVAL 1+1 SECOND
588NULL
589SELECT 1%2 - INTERVAL 1^1 SECOND | 1%2 - INTERVAL 1^1 SECOND;
5901%2 - INTERVAL 1^1 SECOND | 1%2 - INTERVAL 1^1 SECOND
591NULL
592CREATE TABLE t1 (a INT, b DATETIME);
593INSERT INTO t1 VALUES (INTERVAL(3,2,1) + 1, "1997-12-31 23:59:59" + INTERVAL 1 SECOND);
594SELECT * FROM t1 WHERE a = INTERVAL(3,2,1) + 1;
595a	b
5963	1998-01-01 00:00:00
597DROP TABLE t1;
598DROP TABLE IF EXISTS t1,t2,t3;
599CREATE TABLE t1 (a1 INT, a2 INT, a3 INT, a4 DATETIME);
600CREATE TABLE t2 LIKE t1;
601CREATE TABLE t3 LIKE t1;
602SELECT t1.* FROM t1 AS t0, { OJ t2 INNER JOIN t1 ON (t1.a1=t2.a1) } WHERE t0.a3=2;
603a1	a2	a3	a4
604SELECT t1.*,t2.* FROM { OJ ((t1 INNER JOIN t2 ON (t1.a1=t2.a2)) LEFT OUTER JOIN t3 ON t3.a3=t2.a1)};
605a1	a2	a3	a4	a1	a2	a3	a4
606SELECT t1.*,t2.* FROM { OJ ((t1 LEFT OUTER JOIN t2 ON t1.a3=t2.a2) INNER JOIN t3 ON (t3.a1=t2.a2))};
607a1	a2	a3	a4	a1	a2	a3	a4
608SELECT t1.*,t2.* FROM { OJ (t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a2) CROSS JOIN t3 ON (t3.a2=t2.a3)};
609a1	a2	a3	a4	a1	a2	a3	a4
610SELECT * FROM {oj t1 LEFT OUTER JOIN t2 ON t1.a1=t2.a3} WHERE t1.a2 > 10;
611a1	a2	a3	a4	a1	a2	a3	a4
612SELECT {fn CONCAT(a1,a2)} FROM t1;
613{fn CONCAT(a1,a2)}
614UPDATE t3 SET a4={d '1789-07-14'} WHERE a1=0;
615SELECT a1, a4 FROM t2 WHERE a4 LIKE {fn UCASE('1789-07-14')};
616a1	a4
617DROP TABLE t1, t2, t3;
618#
619# End of 5.1 tests
620#
621#
622# Bug#17075846 : unquoted file names for variable values are
623#                accepted but parsed incorrectly
624#
625SET default_storage_engine=a.myisam;
626ERROR 42000: Incorrect argument type to variable 'default_storage_engine'
627SET default_storage_engine = .a.MyISAM;
628ERROR 42000: Incorrect argument type to variable 'default_storage_engine'
629SET default_storage_engine = a.b.MyISAM;
630ERROR 42000: Incorrect argument type to variable 'default_storage_engine'
631SET default_storage_engine = `a`.MyISAM;
632ERROR 42000: Incorrect argument type to variable 'default_storage_engine'
633SET default_storage_engine = `a`.`MyISAM`;
634ERROR 42000: Incorrect argument type to variable 'default_storage_engine'
635set default_storage_engine = "a.MYISAM";
636ERROR 42000: Unknown storage engine 'a.MYISAM'
637set default_storage_engine = 'a.MYISAM';
638ERROR 42000: Unknown storage engine 'a.MYISAM'
639set default_storage_engine = `a.MYISAM`;
640ERROR 42000: Unknown storage engine 'a.MYISAM'
641CREATE TABLE t1 (s VARCHAR(100));
642CREATE TRIGGER trigger1 BEFORE INSERT ON t1 FOR EACH ROW
643SET default_storage_engine = NEW.INNODB;
644ERROR 42S22: Unknown column 'INNODB' in 'NEW'
645DROP TABLE t1;
646select 0==0;
647ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '=0' at line 1
648select 1=!0,  1 = ! 0;
6491=!0	1 = ! 0
6501	1
651select !!0,     ! ! 0;
652!!0	! ! 0
6530	0
654select 2>!0,  2 > ! 0;
6552>!0	2 > ! 0
6561	1
657select 0<=!0, 0 <= !0;
6580<=!0	0 <= !0
6591	1
660select 1<<!0, 1 << !0;
6611<<!0	1 << !0
6622	2
663select 0<!0,  0 < ! 0;
6640<!0	0 < ! 0
6651	1
666#
667# MDEV-11171 Assertion `m_cpp_buf <= ptr && ptr <= m_cpp_buf + m_buf_length' failed in Lex_input_stream::body_utf8_append(const char*, const char*)
668#
669CREATE TABLE t1 (id INT);
670CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
671ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1
672PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
673ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1
674DROP TABLE t1;
675#
676# MDEV-7792 - SQL Parsing Error - UNION AND ORDER BY WITH JOIN
677#
678CREATE TABLE t1(a INT);
679SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
680a	b
681DROP TABLE t1;
682#
683# Test of collective fix for three parser bugs:
684#
685# Bug #17727401, Bug #17426017, Bug #17473479:
686#   The server accepts wrong syntax and then fails in different ways
687#
688CREATE TABLE t1 (i INT);
689# bug #17426017
690SELECT (SELECT EXISTS(SELECT * LIMIT 1 ORDER BY VALUES (c00)));
691ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY VALUES (c00)))' at line 1
692# bug#17473479
693CREATE TABLE a(a int);
694CREATE TABLE b(a int);
695DELETE FROM b ORDER BY(SELECT 1 FROM a ORDER BY a ORDER BY a);
696ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY a)' at line 1
697DROP TABLE a, b;
698# bug #17727401
699SELECT '' IN (SELECT '1' c FROM t1 ORDER BY '' ORDER BY '') FROM t1;
700ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY '') FROM t1' at line 1
701# regression & coverage tests
702# uniform syntax for FROM DUAL clause:
703SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
704FOR UPDATE;
7051
7061
707SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
708PROCEDURE ANALYSE();
709ERROR HY000: Can't use ORDER clause with this procedure
710SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
711PROCEDURE ANALYSE() FOR UPDATE;
712ERROR HY000: Can't use ORDER clause with this procedure
713SELECT 1 FROM
714(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
715FOR UPDATE) a;
7161
7171
718SELECT 1 FROM
719(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
720PROCEDURE ANALYSE() FOR UPDATE) a;
721ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE) a' at line 3
722SELECT 1 FROM t1
723WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
724FOR UPDATE);
7251
726SELECT 1 FROM t1
727WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
728PROCEDURE ANALYSE() FOR UPDATE);
729ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE)' at line 3
730SELECT 1 FROM t1
731UNION
732SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
733FOR UPDATE;
7341
7351
736SELECT 1 FROM t1
737UNION
738SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
739PROCEDURE ANALYSE() FOR UPDATE;
740ERROR 42000: Incorrect usage/placement of 'PROCEDURE'
741SELECT 1 FROM DUAL PROCEDURE ANALYSE()
742UNION
743SELECT 1 FROM t1;
744ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
745SELECT 1 FROM t1' at line 2
746(SELECT 1 FROM t1)
747UNION
748(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
749FOR UPDATE);
7501
7511
752(SELECT 1 FROM t1)
753UNION
754(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
755PROCEDURE ANALYSE() FOR UPDATE);
756ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE() FOR UPDATE)' at line 4
757# "FOR UPDATE" tests
758SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
7591
760(SELECT 1 FROM t1 FOR UPDATE) UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
7611
762SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE;
7631
764# "INTO" clause tests
765SELECT 1 FROM t1 INTO @var17727401;
766Warnings:
767Warning	1287	'<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
768Warning	1329	No data - zero rows fetched, selected, or processed
769SELECT 1 FROM DUAL INTO @var17727401;
770Warnings:
771Warning	1287	'<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
772SELECT 1 INTO @var17727401;
773SELECT 1 INTO @var17727401 FROM t1;
774Warnings:
775Warning	1329	No data - zero rows fetched, selected, or processed
776SELECT 1 INTO @var17727401 FROM DUAL;
777SELECT 1 INTO @var17727401_1 FROM t1 INTO @var17727401_2;
778ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 1
779SELECT 1 INTO @var17727401_1 FROM DUAL
780INTO @var17727401_2;
781ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 2
782SELECT 1 INTO @var17727401 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
783Warnings:
784Warning	1329	No data - zero rows fetched, selected, or processed
785SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401;
786Warnings:
787Warning	1287	'<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
788Warning	1329	No data - zero rows fetched, selected, or processed
789SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
790ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1' at line 1
791SELECT 1 INTO @var17727401_1
792FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1
793INTO @var17727401_2;
794ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401_2' at line 3
795SELECT (SELECT 1 FROM t1 INTO @var17727401);
796ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1
797SELECT 1 FROM (SELECT 1 FROM t1 INTO @var17727401) a;
798ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401) a' at line 1
799SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401);
800ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401)' at line 1
801SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
802ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 INTO t1' at line 1
803(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
804ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1)' at line 1
805SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
806Warnings:
807Warning	1287	'<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
808Warning	1329	No data - zero rows fetched, selected, or processed
809SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE();
810ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE()' at line 1
811SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
812ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INTO @var17727401' at line 1
813# ORDER and LIMIT clause combinations
814((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1);
815ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
816((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1);
817ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
818SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1;
8191
820SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1);
821(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1)
822NULL
823SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
8241
825SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1;
8261
827SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1);
828(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1)
829NULL
830SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1) a;
8311
832SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
8331
834SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1);
835(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1)
836NULL
837SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1) a;
8381
839SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1;
840ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1' at line 1
841SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1);
842ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1)' at line 1
843SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1) a;
844ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1) a' at line 1
845SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
846ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
847SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1);
848ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
849SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
850ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
851SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
852ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
853SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1);
854ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
855SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a;
856ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
857SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
858ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1' at line 1
859SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1);
860ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1)' at line 1
861SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a;
862ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1) a' at line 1
863SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
864ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1' at line 1
865SELECT (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1);
866ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1)' at line 1
867SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
868ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ORDER BY 1 UNION SELECT 1 FROM t1) a' at line 1
869SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
870ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
871SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1);
872ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
873SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
874ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
875SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
876ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
877SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1);
878ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
879SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
880ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
881SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
882ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1' at line 1
883SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1);
884ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1)' at line 1
885SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
886ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 ORDER BY 1) a' at line 1
887SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
888ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1' at line 1
889SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1);
890ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1)' at line 1
891SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
892ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 1 FROM t1 LIMIT 1) a' at line 1
893DROP TABLE t1;
894#
895# MDEV-8380: Subquery parse error
896#
897CREATE TABLE t1 ( a INT);
898INSERT INTO t1 VALUES ( 2 );
899SELECT *
900FROM ( (SELECT a FROM t1 ORDER BY a) UNION (SELECT 1 as b ORDER BY b ) ) AS a1
901WHERE a1.a = 1 OR a1.a = 2;
902a
9032
9041
905DROP TABLE t1;
906#
907# MDEV-10080 Derived tables allow double LIMIT clause
908#
909CREATE TABLE t1 (a INT);
910INSERT INTO t1 VALUES (1),(2),(3);
911SELECT * FROM  (SELECT * FROM t1 LIMIT 1 LIMIT 2) t1;
912ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'LIMIT 2) t1' at line 1
913DROP TABLE t1;
914#
915# MDEV-10109 Disallow syntactically INSERT .. SELECT .. {ORDER BY ..| LIMIT ..} .. UNION ..
916#
917INSERT INTO t1 SELECT 1 ORDER BY 1 UNION SELECT 2;
918ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
919INSERT INTO t1 SELECT 1 LIMIT 1 UNION SELECT 2;
920ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
921CREATE TABLE t1 AS SELECT 1 ORDER BY 1 UNION SELECT 2;
922ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
923CREATE TABLE t1 AS SELECT 1 LIMIT 1 UNION SELECT 2;
924ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION SELECT 2' at line 1
925#
926# MDEV-8909 union parser cleanup
927#
928# UNION with a non-parenthesized term
929# The following two queries return a wrong result
930# This will change when MDEV-10120 is fixed
931# For now, we're testing the parser.
932CREATE TABLE t1 (a INT);
933INSERT INTO t1 VALUES (10),(20),(30);
934SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
935ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
936SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
937ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
938DROP TABLE t1;
939# UNION with a parenthesed term
940CREATE TABLE t1 (a INT);
941INSERT INTO t1 VALUES (10),(20),(30);
942SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 2);
943a
9441
94510
94620
947SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a));
948a
9491
95010
95120
95230
953SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) LIMIT 1;
954a
9551
956SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a;
957a
9581
95910
96020
96130
962SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a ORDER BY GROUP_CONCAT(a)) ORDER BY a LIMIT 1;
963a
9641
965DROP TABLE t1;
966# UNION with a parenthesized term with ROLLUP
967CREATE TABLE t1 (a INT);
968INSERT INTO t1 VALUES (10),(20),(30);
969SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
970a
9711
97210
97320
97430
975NULL
976SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
977a
9781
979SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
980a
981NULL
982SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
983a
9841
98510
98620
987SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
988ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
989SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
990ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
991SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a));
992ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
993DROP TABLE t1;
994# UNION with a non-parethesized term with ROLLUP
995# This will change after: MDEV-10120 Wrong result of UNION .. ORDER BY GROUP_CONCAT()
996# Currently we're testing the parser only
997CREATE TABLE t1 (a INT);
998INSERT INTO t1 VALUES (10),(20),(30);
999SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a);
1000ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
1001SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a);
1002ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
1003SELECT 1 AS a UNION SELECT a FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
1004ERROR HY000: Expression #1 of ORDER BY contains aggregate function and applies to a UNION
1005DROP TABLE t1;
1006# Derived table with ROLLUP
1007CREATE TABLE t1 (a INT);
1008INSERT INTO t1 VALUES (10),(20),(30);
1009SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1;
1010a
101110
101220
101330
1014NULL
1015SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 LIMIT 1;
1016a
101710
1018SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a;
1019a
1020NULL
102110
102220
102330
1024SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a LIMIT 1;
1025a
1026NULL
1027SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY a DESC LIMIT 1;
1028a
102930
1030SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a);
1031a	GROUP_CONCAT(a)
103210	10,20,30
1033SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a ORDER BY a);
1034a	GROUP_CONCAT(a)
103510	10,20,30
1036SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a) LIMIT 1;
1037a	GROUP_CONCAT(a)
103810	10,20,30
1039SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
1040a	GROUP_CONCAT(a)
104110	10,20,30
1042SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a);
1043a	GROUP_CONCAT(a)
1044NULL	NULL
104510	10
104620	20
104730	30
1048SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a);
1049a	GROUP_CONCAT(a)
1050NULL	NULL
105110	10
105220	20
105330	30
1054SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) DESC;
1055a	GROUP_CONCAT(a)
105630	30
105720	20
105810	10
1059NULL	NULL
1060SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) DESC;
1061a	GROUP_CONCAT(a)
106230	30
106320	20
106410	10
1065NULL	NULL
1066SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) LIMIT 1;
1067a	GROUP_CONCAT(a)
1068NULL	NULL
1069SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) LIMIT 1;
1070a	GROUP_CONCAT(a)
1071NULL	NULL
1072SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a) DESC LIMIT 1;
1073a	GROUP_CONCAT(a)
107430	30
1075SELECT a, GROUP_CONCAT(a) FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP) t1 GROUP BY a ORDER BY GROUP_CONCAT(a ORDER BY a) DESC LIMIT 1;
1076a	GROUP_CONCAT(a)
107730	30
1078SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) t1;
1079ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1080SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) t1;
1081ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1082SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) t1;
1083ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1084SELECT * FROM (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a ORDER BY a)) t1;
1085ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1086DROP TABLE t1;
1087# Subquery, one row, ROLLUP
1088CREATE TABLE t1 (a INT);
1089INSERT INTO t1 VALUES (10);
1090SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL);
1091(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL)
1092NULL
1093SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL);
1094(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL)
109510
1096SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1097(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
109810
1099SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1100(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
110110
1102SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1103(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
110410
1105SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL) FROM t1;
1106(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NULL)
1107NULL
1108SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL) FROM t1;
1109(SELECT * FROM t1 GROUP BY a WITH ROLLUP HAVING a IS NOT NULL)
111010
1111SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1112(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
111310
1114SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1115(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
111610
1117SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1118(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
111910
1120SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
1121ERROR 21000: Subquery returns more than 1 row
1122SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
1123ERROR 21000: Subquery returns more than 1 row
1124SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
1125ERROR 21000: Subquery returns more than 1 row
1126SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
1127ERROR 21000: Subquery returns more than 1 row
1128SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
1129ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1130SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
1131ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1132SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
1133ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1134SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
1135ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1136SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
1137ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1138SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
1139ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1140SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
1141ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1142SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
1143ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1144DROP TABLE t1;
1145# Subquery, multiple rows, ROLLUP
1146CREATE TABLE t1 (a INT);
1147INSERT INTO t1 VALUES (10),(20),(30);
1148SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1149(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
115010
1151SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1152(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
115310
1154SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1);
1155(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
115610
1157SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1158(SELECT * FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
115910
116010
116110
1162SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1163(SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
116410
116510
116610
1167SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1) FROM t1;
1168(SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1)
116910
117010
117110
1172SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP);
1173ERROR 21000: Subquery returns more than 1 row
1174SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP);
1175ERROR 21000: Subquery returns more than 1 row
1176SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
1177ERROR 21000: Subquery returns more than 1 row
1178SELECT (SELECT GROUP_CONCAT(a) FROM t1 GROUP BY a WITH ROLLUP) FROM t1;
1179ERROR 21000: Subquery returns more than 1 row
1180SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a);
1181ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1182SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1);
1183ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1184SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a));
1185ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1186SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a;
1187ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1188SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a) FROM t1;
1189ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1190SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) FROM t1;
1191ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1192SELECT (SELECT * FROM t1 GROUP BY a WITH ROLLUP ORDER BY GROUP_CONCAT(a)) FROM t1;
1193ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1194SELECT (SELECT GROUP_CONCAT(a ORDER BY a) FROM t1 GROUP BY a WITH ROLLUP ORDER BY a LIMIT 1) AS a FROM t1;
1195ERROR HY000: Incorrect usage of CUBE/ROLLUP and ORDER BY
1196DROP TABLE t1;
1197
1198MDEV-10101 Wrong error message of SELECT 1 UNION (SELECT 1 FROM t1 GROUP BY 1 WITH ROLLUP)
1199
1200CREATE TABLE t1 (a INT);
1201INSERT INTO t1 VALUES (10),(20),(30);
1202SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP);
1203a
12041
120510
120620
120730
1208NULL
1209(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1;
1210a
121110
121220
121330
1214NULL
12151
1216SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1;
1217a
121810
121920
122030
1221NULL
12221
1223SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) LIMIT 1;
1224a
12251
1226(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 LIMIT 1;
1227a
122810
1229SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 LIMIT 1;
1230a
123110
1232SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP) ORDER BY a LIMIT 1;
1233a
1234NULL
1235(SELECT a FROM t1 GROUP BY a WITH ROLLUP) UNION SELECT 1 ORDER BY a LIMIT 1;
1236a
1237NULL
1238SELECT a FROM t1 GROUP BY a WITH ROLLUP UNION SELECT 1 ORDER BY a LIMIT 1;
1239a
1240NULL
1241SELECT 1 AS a UNION (SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2);
1242a
12431
124410
124520
1246(SELECT a FROM t1 GROUP BY a WITH ROLLUP LIMIT 2) UNION SELECT 1;
1247a
124810
124920
12501
1251DROP TABLE t1;
1252#
1253# MDEV-10779 Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION
1254#
1255CREATE TABLE t1 (i INT);
1256(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
1257UNION
1258(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
1259ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(10, 10))
1260UNION
1261(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))' at line 1
1262(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
1263UNION
1264SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
1265ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(10, 10))
1266UNION
1267SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)' at line 1
1268(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
1269UNION
1270(SELECT 1);
1271ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(10, 10))
1272UNION
1273(SELECT 1)' at line 1
1274(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))
1275UNION
1276SELECT 1;
1277ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PROCEDURE ANALYSE(10, 10))
1278UNION
1279SELECT 1' at line 1
1280SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
1281UNION
1282(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10));
1283ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
1284(SELECT * FROM t1 PROCEDURE ANALYSE(10, 10))' at line 2
1285SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
1286UNION
1287SELECT * FROM t1 PROCEDURE ANALYSE(10, 10);
1288ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
1289SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)' at line 2
1290SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
1291UNION
1292(SELECT 1);
1293ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
1294(SELECT 1)' at line 2
1295SELECT * FROM t1 PROCEDURE ANALYSE(10, 10)
1296UNION
1297SELECT 1;
1298ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNION
1299SELECT 1' at line 2
1300DROP TABLE t1;
1301create table t1 (a serial null);
1302ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'null)' at line 1
1303create table t1 (a serial auto_increment);
1304ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'auto_increment)' at line 1
1305create table t1 (a serial serial default value);
1306ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'serial default value)' at line 1
1307create table t1 (a serial collate binary);
1308ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'collate binary)' at line 1
1309create table t1 (i int, vc serial as (i));
1310ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'as (i))' at line 1
1311create function fs() returns serial return 1;
1312ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'serial return 1' at line 1
1313create table t1 ( id serial );
1314show create table t1;
1315Table	Create Table
1316t1	CREATE TABLE `t1` (
1317  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1318  UNIQUE KEY `id` (`id`)
1319) ENGINE=MyISAM DEFAULT CHARSET=latin1
1320drop table t1;
1321create or replace view v1 as select 1 between (2 between 3 and 4) and 5;
1322Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
1323view_definition
1324select 1 between 2 between 3 and 4 and 5 AS `1 between (2 between 3 and 4) and 5`
1325create or replace view v1 as select 1 between (2 in (3,4)) and 5;
1326Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
1327view_definition
1328select 1 between 2 in (3,4) and 5 AS `1 between (2 in (3,4)) and 5`
1329create or replace view v1 as select 1 between (2 like 3) and 4;
1330Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
1331view_definition
1332select 1 between 2 like 3 and 4 AS `1 between (2 like 3) and 4`
1333create or replace view v1 as select 1 not between (2 like 3) and 4;
1334Select view_definition from information_schema.views where table_schema='test' and table_name='v1';
1335view_definition
1336select 1 not between 2 like 3 and 4 AS `1 not between (2 like 3) and 4`
1337drop view v1;
1338#
1339# Start of 10.2 tests
1340#
1341#
1342# MDEV-27066 Fixed scientific notation parser
1343#
1344SELECT 1 1.e*1;
1345ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e*1' at line 1
1346SELECT 1 1.e/1;
1347ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e/1' at line 1
1348SELECT 1 1.e^1;
1349ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e^1' at line 1
1350SELECT 1 1.e%1;
1351ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e%1' at line 1
1352SELECT 1 1.e&1;
1353ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e&1' at line 1
1354SELECT 1 1.e|1;
1355ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e|1' at line 1
1356SELECT 1.e(1);
1357ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e(1)' at line 1
1358SELECT (1 1.e);
1359ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e)' at line 1
1360SELECT 1 1.e, 1;
1361ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e, 1' at line 1
1362CREATE TABLE scientific_notation (test int);
1363SELECT tmp 1.e.test FROM scientific_notation AS tmp;
1364ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e.test FROM scientific_notation AS tmp' at line 1
1365DROP TABLE scientific_notation;
1366#
1367# End of 10.2 tests
1368#
1369#
1370# MDEV-10343 Providing compatibility for basic SQL data types
1371#
1372CREATE TABLE clob (clob int);
1373DROP TABLE clob;
1374CREATE TABLE raw (raw int);
1375DROP TABLE raw;
1376CREATE TABLE varchar2 (varchar2 int);
1377DROP TABLE varchar2;
1378#
1379# MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger
1380#
1381CREATE TABLE t1 (a INT);
1382CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0;
1383ERROR HY000: Unknown structured system variable or ROW routine variable 'NEW'
1384DROP TABLE t1;
1385#
1386# MDEV-15664 sql_mode=ORACLE: Make TRIM return NULL instead of empty string
1387#
1388CREATE TABLE trim_oracle (trim_oracle int);
1389DROP TABLE trim_oracle;
1390#
1391# MDEV-15615 Unexpected syntax error instead of "Unknown system variable" inside an SP
1392#
1393BEGIN NOT ATOMIC
1394DECLARE a INT;
1395SET GLOBAL a=10;
1396END;
1397$$
1398ERROR HY000: Unknown system variable 'a'
1399#
1400# MDEV-16202 Latest changes made erroneously some keywords reserved in sql_mode=ORACLE
1401#
1402CREATE PROCEDURE p1(name VARCHAR(64), pattern TEXT)
1403BEGIN
1404DECLARE query TEXT DEFAULT REPLACE(pattern, 'name', name);
1405DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
1406BEGIN
1407SHOW ERRORS;
1408END;
1409SELECT query AS '';
1410EXECUTE IMMEDIATE query;
1411END;
1412$$
1413CREATE PROCEDURE p2(name VARCHAR(64))
1414BEGIN
1415CALL p1(name, 'BEGIN NOT ATOMIC DECLARE name INT; SET name=10; SELECT name; END');
1416EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (name INT)', 'name', name);
1417CALL p1(name, 'SELECT name FROM t1');
1418CALL p1(name, 'SELECT name ''alias'' FROM t1');
1419CALL p1(name, 'SELECT name()');
1420CALL p1(name, 'SELECT name.name()');
1421CALL p1(name, 'SELECT name DATE FROM t1');
1422CALL p1(name, 'SELECT name HISTORY FROM t1');
1423CALL p1(name, 'SELECT name NEXT FROM t1');
1424CALL p1(name, 'SELECT name PERIOD FROM t1');
1425CALL p1(name, 'SELECT name PREVIOUS FROM t1');
1426CALL p1(name, 'SELECT name SYSTEM FROM t1');
1427CALL p1(name, 'SELECT name SYSTEM_TIME FROM t1');
1428CALL p1(name, 'SELECT name TIME FROM t1');
1429CALL p1(name, 'SELECT name TIMESTAMP FROM t1');
1430CALL p1(name, 'SELECT name TRANSACTION FROM t1');
1431CALL p1(name, 'SELECT name VALUE FROM t1');
1432CALL p1(name, 'SELECT name VERSIONING FROM t1');
1433CALL p1(name, 'SELECT name WITHOUT FROM t1');
1434CALL p1(name, 'SELECT name OVERLAPS FROM t1');
1435DROP TABLE t1;
1436END;
1437$$
1438CALL p2('date');
1439BEGIN NOT ATOMIC DECLARE date INT; SET date=10; SELECT date; END
144010
1441SELECT date FROM t1
1442SELECT date 'alias' FROM t1
1443Error	1525	Incorrect DATE value: 'alias'
1444SELECT date()
1445Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
1446SELECT date.date()
1447Error	1630	FUNCTION date.date does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1448SELECT date DATE FROM t1
1449SELECT date HISTORY FROM t1
1450SELECT date NEXT FROM t1
1451SELECT date PERIOD FROM t1
1452SELECT date PREVIOUS FROM t1
1453SELECT date SYSTEM FROM t1
1454SELECT date SYSTEM_TIME FROM t1
1455SELECT date TIME FROM t1
1456SELECT date TIMESTAMP FROM t1
1457SELECT date TRANSACTION FROM t1
1458SELECT date VALUE FROM t1
1459SELECT date VERSIONING FROM t1
1460SELECT date WITHOUT FROM t1
1461SELECT date OVERLAPS FROM t1
1462CALL p2('history');
1463BEGIN NOT ATOMIC DECLARE history INT; SET history=10; SELECT history; END
146410
1465SELECT history FROM t1
1466SELECT history 'alias' FROM t1
1467SELECT history()
1468Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1469SELECT history.history()
1470Error	1630	FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1471SELECT history DATE FROM t1
1472SELECT history HISTORY FROM t1
1473SELECT history NEXT FROM t1
1474SELECT history PERIOD FROM t1
1475SELECT history PREVIOUS FROM t1
1476SELECT history SYSTEM FROM t1
1477SELECT history SYSTEM_TIME FROM t1
1478SELECT history TIME FROM t1
1479SELECT history TIMESTAMP FROM t1
1480SELECT history TRANSACTION FROM t1
1481SELECT history VALUE FROM t1
1482SELECT history VERSIONING FROM t1
1483SELECT history WITHOUT FROM t1
1484SELECT history OVERLAPS FROM t1
1485CALL p2('next');
1486BEGIN NOT ATOMIC DECLARE next INT; SET next=10; SELECT next; END
148710
1488SELECT next FROM t1
1489SELECT next 'alias' FROM t1
1490SELECT next()
1491Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1492SELECT next.next()
1493Error	1630	FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1494SELECT next DATE FROM t1
1495SELECT next HISTORY FROM t1
1496SELECT next NEXT FROM t1
1497SELECT next PERIOD FROM t1
1498SELECT next PREVIOUS FROM t1
1499SELECT next SYSTEM FROM t1
1500SELECT next SYSTEM_TIME FROM t1
1501SELECT next TIME FROM t1
1502SELECT next TIMESTAMP FROM t1
1503SELECT next TRANSACTION FROM t1
1504SELECT next VALUE FROM t1
1505Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM t1' at line 1
1506SELECT next VERSIONING FROM t1
1507SELECT next WITHOUT FROM t1
1508SELECT next OVERLAPS FROM t1
1509CALL p2('period');
1510BEGIN NOT ATOMIC DECLARE period INT; SET period=10; SELECT period; END
151110
1512SELECT period FROM t1
1513SELECT period 'alias' FROM t1
1514SELECT period()
1515Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1516SELECT period.period()
1517Error	1630	FUNCTION period.period does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1518SELECT period DATE FROM t1
1519SELECT period HISTORY FROM t1
1520SELECT period NEXT FROM t1
1521SELECT period PERIOD FROM t1
1522SELECT period PREVIOUS FROM t1
1523SELECT period SYSTEM FROM t1
1524SELECT period SYSTEM_TIME FROM t1
1525SELECT period TIME FROM t1
1526SELECT period TIMESTAMP FROM t1
1527SELECT period TRANSACTION FROM t1
1528SELECT period VALUE FROM t1
1529SELECT period VERSIONING FROM t1
1530SELECT period WITHOUT FROM t1
1531SELECT period OVERLAPS FROM t1
1532CALL p2('previous');
1533BEGIN NOT ATOMIC DECLARE previous INT; SET previous=10; SELECT previous; END
153410
1535SELECT previous FROM t1
1536SELECT previous 'alias' FROM t1
1537SELECT previous()
1538Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1539SELECT previous.previous()
1540Error	1630	FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1541SELECT previous DATE FROM t1
1542SELECT previous HISTORY FROM t1
1543SELECT previous NEXT FROM t1
1544SELECT previous PERIOD FROM t1
1545SELECT previous PREVIOUS FROM t1
1546SELECT previous SYSTEM FROM t1
1547SELECT previous SYSTEM_TIME FROM t1
1548SELECT previous TIME FROM t1
1549SELECT previous TIMESTAMP FROM t1
1550SELECT previous TRANSACTION FROM t1
1551SELECT previous VALUE FROM t1
1552Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM t1' at line 1
1553SELECT previous VERSIONING FROM t1
1554SELECT previous WITHOUT FROM t1
1555SELECT previous OVERLAPS FROM t1
1556CALL p2('system');
1557BEGIN NOT ATOMIC DECLARE system INT; SET system=10; SELECT system; END
155810
1559SELECT system FROM t1
1560SELECT system 'alias' FROM t1
1561SELECT system()
1562Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1563SELECT system.system()
1564Error	1630	FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1565SELECT system DATE FROM t1
1566SELECT system HISTORY FROM t1
1567SELECT system NEXT FROM t1
1568SELECT system PERIOD FROM t1
1569SELECT system PREVIOUS FROM t1
1570SELECT system SYSTEM FROM t1
1571SELECT system SYSTEM_TIME FROM t1
1572SELECT system TIME FROM t1
1573SELECT system TIMESTAMP FROM t1
1574SELECT system TRANSACTION FROM t1
1575SELECT system VALUE FROM t1
1576SELECT system VERSIONING FROM t1
1577SELECT system WITHOUT FROM t1
1578SELECT system OVERLAPS FROM t1
1579CALL p2('system_time');
1580BEGIN NOT ATOMIC DECLARE system_time INT; SET system_time=10; SELECT system_time; END
158110
1582SELECT system_time FROM t1
1583SELECT system_time 'alias' FROM t1
1584SELECT system_time()
1585Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1586SELECT system_time.system_time()
1587Error	1630	FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1588SELECT system_time DATE FROM t1
1589SELECT system_time HISTORY FROM t1
1590SELECT system_time NEXT FROM t1
1591SELECT system_time PERIOD FROM t1
1592SELECT system_time PREVIOUS FROM t1
1593SELECT system_time SYSTEM FROM t1
1594SELECT system_time SYSTEM_TIME FROM t1
1595SELECT system_time TIME FROM t1
1596SELECT system_time TIMESTAMP FROM t1
1597SELECT system_time TRANSACTION FROM t1
1598SELECT system_time VALUE FROM t1
1599SELECT system_time VERSIONING FROM t1
1600SELECT system_time WITHOUT FROM t1
1601SELECT system_time OVERLAPS FROM t1
1602CALL p2('time');
1603BEGIN NOT ATOMIC DECLARE time INT; SET time=10; SELECT time; END
160410
1605SELECT time FROM t1
1606SELECT time 'alias' FROM t1
1607Error	1525	Incorrect TIME value: 'alias'
1608SELECT time()
1609Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
1610SELECT time.time()
1611Error	1630	FUNCTION time.time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1612SELECT time DATE FROM t1
1613SELECT time HISTORY FROM t1
1614SELECT time NEXT FROM t1
1615SELECT time PERIOD FROM t1
1616SELECT time PREVIOUS FROM t1
1617SELECT time SYSTEM FROM t1
1618SELECT time SYSTEM_TIME FROM t1
1619SELECT time TIME FROM t1
1620SELECT time TIMESTAMP FROM t1
1621SELECT time TRANSACTION FROM t1
1622SELECT time VALUE FROM t1
1623SELECT time VERSIONING FROM t1
1624SELECT time WITHOUT FROM t1
1625SELECT time OVERLAPS FROM t1
1626CALL p2('timestamp');
1627BEGIN NOT ATOMIC DECLARE timestamp INT; SET timestamp=10; SELECT timestamp; END
162810
1629SELECT timestamp FROM t1
1630SELECT timestamp 'alias' FROM t1
1631Error	1525	Incorrect DATETIME value: 'alias'
1632SELECT timestamp()
1633Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
1634SELECT timestamp.timestamp()
1635Error	1630	FUNCTION timestamp.timestamp does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1636SELECT timestamp DATE FROM t1
1637SELECT timestamp HISTORY FROM t1
1638SELECT timestamp NEXT FROM t1
1639SELECT timestamp PERIOD FROM t1
1640SELECT timestamp PREVIOUS FROM t1
1641SELECT timestamp SYSTEM FROM t1
1642SELECT timestamp SYSTEM_TIME FROM t1
1643SELECT timestamp TIME FROM t1
1644SELECT timestamp TIMESTAMP FROM t1
1645SELECT timestamp TRANSACTION FROM t1
1646SELECT timestamp VALUE FROM t1
1647SELECT timestamp VERSIONING FROM t1
1648SELECT timestamp WITHOUT FROM t1
1649SELECT timestamp OVERLAPS FROM t1
1650CALL p2('transaction');
1651BEGIN NOT ATOMIC DECLARE transaction INT; SET transaction=10; SELECT transaction; END
165210
1653SELECT transaction FROM t1
1654SELECT transaction 'alias' FROM t1
1655SELECT transaction()
1656Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1657SELECT transaction.transaction()
1658Error	1630	FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1659SELECT transaction DATE FROM t1
1660SELECT transaction HISTORY FROM t1
1661SELECT transaction NEXT FROM t1
1662SELECT transaction PERIOD FROM t1
1663SELECT transaction PREVIOUS FROM t1
1664SELECT transaction SYSTEM FROM t1
1665SELECT transaction SYSTEM_TIME FROM t1
1666SELECT transaction TIME FROM t1
1667SELECT transaction TIMESTAMP FROM t1
1668SELECT transaction TRANSACTION FROM t1
1669SELECT transaction VALUE FROM t1
1670SELECT transaction VERSIONING FROM t1
1671SELECT transaction WITHOUT FROM t1
1672SELECT transaction OVERLAPS FROM t1
1673CALL p2('value');
1674BEGIN NOT ATOMIC DECLARE value INT; SET value=10; SELECT value; END
167510
1676SELECT value FROM t1
1677SELECT value 'alias' FROM t1
1678SELECT value()
1679Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
1680SELECT value.value()
1681Error	1630	FUNCTION value.value does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1682SELECT value DATE FROM t1
1683SELECT value HISTORY FROM t1
1684SELECT value NEXT FROM t1
1685SELECT value PERIOD FROM t1
1686SELECT value PREVIOUS FROM t1
1687SELECT value SYSTEM FROM t1
1688SELECT value SYSTEM_TIME FROM t1
1689SELECT value TIME FROM t1
1690SELECT value TIMESTAMP FROM t1
1691SELECT value TRANSACTION FROM t1
1692SELECT value VALUE FROM t1
1693SELECT value VERSIONING FROM t1
1694SELECT value WITHOUT FROM t1
1695SELECT value OVERLAPS FROM t1
1696CALL p2('versioning');
1697BEGIN NOT ATOMIC DECLARE versioning INT; SET versioning=10; SELECT versioning; END
169810
1699SELECT versioning FROM t1
1700SELECT versioning 'alias' FROM t1
1701SELECT versioning()
1702Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1703SELECT versioning.versioning()
1704Error	1630	FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1705SELECT versioning DATE FROM t1
1706SELECT versioning HISTORY FROM t1
1707SELECT versioning NEXT FROM t1
1708SELECT versioning PERIOD FROM t1
1709SELECT versioning PREVIOUS FROM t1
1710SELECT versioning SYSTEM FROM t1
1711SELECT versioning SYSTEM_TIME FROM t1
1712SELECT versioning TIME FROM t1
1713SELECT versioning TIMESTAMP FROM t1
1714SELECT versioning TRANSACTION FROM t1
1715SELECT versioning VALUE FROM t1
1716SELECT versioning VERSIONING FROM t1
1717SELECT versioning WITHOUT FROM t1
1718SELECT versioning OVERLAPS FROM t1
1719CALL p2('without');
1720BEGIN NOT ATOMIC DECLARE without INT; SET without=10; SELECT without; END
172110
1722SELECT without FROM t1
1723SELECT without 'alias' FROM t1
1724SELECT without()
1725Error	1064	You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1
1726SELECT without.without()
1727Error	1630	FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1728SELECT without DATE FROM t1
1729SELECT without HISTORY FROM t1
1730SELECT without NEXT FROM t1
1731SELECT without PERIOD FROM t1
1732SELECT without PREVIOUS FROM t1
1733SELECT without SYSTEM FROM t1
1734SELECT without SYSTEM_TIME FROM t1
1735SELECT without TIME FROM t1
1736SELECT without TIMESTAMP FROM t1
1737SELECT without TRANSACTION FROM t1
1738SELECT without VALUE FROM t1
1739SELECT without VERSIONING FROM t1
1740SELECT without WITHOUT FROM t1
1741SELECT without OVERLAPS FROM t1
1742CALL p2('overlaps');
1743BEGIN NOT ATOMIC DECLARE overlaps INT; SET overlaps=10; SELECT overlaps; END
174410
1745SELECT overlaps FROM t1
1746SELECT overlaps 'alias' FROM t1
1747SELECT overlaps()
1748Error	1582	Incorrect parameter count in the call to native function 'overlaps()'
1749SELECT overlaps.overlaps()
1750Error	1630	FUNCTION overlaps.overlaps does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
1751SELECT overlaps DATE FROM t1
1752SELECT overlaps HISTORY FROM t1
1753SELECT overlaps NEXT FROM t1
1754SELECT overlaps PERIOD FROM t1
1755SELECT overlaps PREVIOUS FROM t1
1756SELECT overlaps SYSTEM FROM t1
1757SELECT overlaps SYSTEM_TIME FROM t1
1758SELECT overlaps TIME FROM t1
1759SELECT overlaps TIMESTAMP FROM t1
1760SELECT overlaps TRANSACTION FROM t1
1761SELECT overlaps VALUE FROM t1
1762SELECT overlaps VERSIONING FROM t1
1763SELECT overlaps WITHOUT FROM t1
1764SELECT overlaps OVERLAPS FROM t1
1765DROP PROCEDURE p2;
1766DROP PROCEDURE p1;
1767#
1768# MDEV-16697: Fix difference between 32bit/windows and 64bit
1769# systems in allowed select nest level
1770#
1771SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1772(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1773(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1774(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1775(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1776(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1777(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1778(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
17791
1780)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
1781(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1782(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1783(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1784(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT
1785(SELECT
17861
1787#
1788# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar
1789#
1790CREATE TABLE names (names INT);
1791SELECT names FROM names AS names;
1792names
1793DROP TABLE names;
1794CREATE TABLE password (password INT);
1795SELECT password FROM password AS password;
1796password
1797DROP TABLE password;
1798CREATE TABLE role (role INT);
1799SELECT role FROM role AS role;
1800role
1801DROP TABLE role;
1802BEGIN NOT ATOMIC
1803DECLARE names    VARCHAR(32) DEFAULT '[names]';
1804DECLARE password VARCHAR(32) DEFAULT '[password]';
1805DECLARE role     VARCHAR(32) DEFAULT '[role]';
1806names:
1807LOOP
1808SELECT names;
1809LEAVE names;
1810END LOOP;
1811password:
1812LOOP
1813SELECT password;
1814LEAVE password;
1815END LOOP;
1816role:
1817LOOP
1818SELECT role;
1819LEAVE role;
1820END LOOP;
1821END;
1822$$
1823names
1824[names]
1825password
1826[password]
1827role
1828[role]
1829BEGIN NOT ATOMIC
1830DECLARE names VARCHAR(32);
1831SET names='[names]';
1832END;
1833$$
1834ERROR 42000: Variable 'names' must be quoted with `...`, or renamed
1835BEGIN NOT ATOMIC
1836DECLARE password VARCHAR(32);
1837SET password='[password]';
1838END;
1839$$
1840ERROR 42000: Variable 'password' must be quoted with `...`, or renamed
1841BEGIN NOT ATOMIC
1842DECLARE role VARCHAR(32);
1843SET role='[role]';
1844END;
1845$$
1846SELECT @@GLOBAL.names;
1847ERROR HY000: Unknown system variable 'names'
1848SELECT @@GLOBAL.password;
1849ERROR HY000: Unknown system variable 'password'
1850SELECT @@GLOBAL.role;
1851ERROR HY000: Unknown system variable 'role'
1852#
1853# MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds
1854#
1855EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
1856ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1
1857EXECUTE IMMEDIATE 'if(`systeminfo';
1858ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1
1859#
1860# MDEV-23666 Assertion failed in Lex_input_stream::body_utf8_append
1861#
1862SET @@sql_mode='ANSI_QUOTES';
1863EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"';
1864ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"' at line 1
1865EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
1866ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"abc' at line 1
1867SET @@sql_mode=@save_sql_mode;
1868# End of 10.3 tests
1869#
1870# MDEV-19540: 10.4 allow lock options with SELECT in brackets
1871# which previous version do not
1872#
1873create table t1 (a int);
1874(select * from t1) for update;
1875a
1876(select * from t1) union (select * from t1) for update;
1877ERROR HY000: Incorrect usage of lock options and SELECT in brackets
1878(select * from t1 for update);
1879a
1880select * from t1 for update;
1881a
1882drop table t1;
1883#
1884# MDEV-20108: [ERROR] mysqld got signal 11 in
1885# st_select_lex::add_table_to_list
1886#
1887CREATE TABLE t1 (c1 INT NULL);
1888CREATE TABLE t2 (c1 INT NULL);
1889SET STATEMENT max_statement_time=900 FOR LOCK TABLES `t1` WRITE;
1890select * from t1;
1891c1
1892select * from t2;
1893ERROR HY000: Table 't2' was not locked with LOCK TABLES
1894SET STATEMENT max_statement_time=900 FOR unlock tables;
1895drop table t1, t2;
1896#
1897# MDEV-21616: Server crash when using
1898# "SET STATEMENT max_statement_time=0 FOR desc xxx" lead to collapse
1899#
1900create table t1 (a int);
1901SET STATEMENT max_statement_time=0 FOR desc t1;
1902Field	Type	Null	Key	Default	Extra
1903a	int(11)	YES		NULL
1904drop table t1;
1905SET STATEMENT max_statement_time=0 FOR do 1;
1906set @save_sql_mode=@@SQL_MODE;
1907set SQL_MODE=ORACLE;
1908create table t1 (a int);
1909SET STATEMENT max_statement_time=0 FOR desc t1;
1910Field	Type	Null	Key	Default	Extra
1911a	int(11)	YES		NULL
1912drop table t1;
1913SET STATEMENT max_statement_time=0 FOR do 1;
1914set SQL_MODE=@save_sql_mode;
1915#
1916# MDEV-21684: mysqld crash with signal 11 when renaming
1917# table+max_statement_time
1918#
1919SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
1920ERROR 42S02: Table 'test.bleh' doesn't exist
1921SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
1922Table	Op	Msg_type	Msg_text
1923test.t1_base	preload_keys	Error	Table 'test.t1_base' doesn't exist
1924test.t1_base	preload_keys	status	Operation failed
1925SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
1926ERROR 42S02: Table 'test.t1' doesn't exist
1927SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
1928SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
1929set @save_sql_mode=@@SQL_MODE;
1930set SQL_MODE=ORACLE;
1931SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
1932ERROR 42S02: Table 'test.bleh' doesn't exist
1933SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
1934Table	Op	Msg_type	Msg_text
1935test.t1_base	preload_keys	Error	Table 'test.t1_base' doesn't exist
1936test.t1_base	preload_keys	status	Operation failed
1937SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
1938ERROR 42S02: Table 'test.t1' doesn't exist
1939SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
1940SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
1941set SQL_MODE=@save_sql_mode;
1942#
1943# MDEV-21997: Server crashes in LEX::create_item_ident_sp
1944# upon use of unknown identifier
1945#
1946/*! IF 1 IN ( SELECT 2 ) OR foo = 3 THEN */ SELECT 4;
1947ERROR 42000: Undeclared variable: foo
1948BEGIN NOT ATOMIC
1949IF (SELECT 2) OR foo = 3 THEN
1950SELECT 4;
1951END IF ;
1952END;
1953$$
1954ERROR 42000: Undeclared variable: foo
1955# ... but if declare it then it still work
1956BEGIN NOT ATOMIC
1957DECLARE foo int;
1958IF (SELECT 2) OR foo = 3 THEN
1959SELECT 4;
1960END IF ;
1961END;
1962$$
19634
19644
1965CASE (SELECT 2) OR foo
1966WHEN 1 THEN
1967SET @x=10;
1968$$
1969ERROR 42000: Undeclared variable: foo
1970/*! WHILE (SELECT 2) OR foo */
1971SET @x=10;
1972END WHILE;
1973$$
1974ERROR 42000: Undeclared variable: foo
1975REPEAT
1976SET @x=10;
1977UNTIL (SELECT 2) OR foo
1978END REPEAT;
1979$$
1980ERROR 42000: Undeclared variable: foo
1981FOR i IN 1..(SELECT 2) OR foo
1982DO
1983SET @x=10;
1984END FOR;
1985$$
1986ERROR 42000: Undeclared variable: foo
1987# ... but automatic FOR variable still work
1988FOR i IN 1..2
1989DO
1990SELECT i;
1991END FOR;
1992$$
1993i
19941
1995i
19962
1997#
1998# MDEV-21998: Server crashes in st_select_lex::add_table_to_list
1999# upon mix of KILL and sequences
2000#
2001KILL ( SELECT 1 ) + LASTVAL(s);
2002ERROR 42000: KILL does not support subqueries or stored functions
2003KILL LASTVAL(s);
2004ERROR 42000: KILL does not support subqueries or stored functions
2005#
2006# MDEV-23094: Multiple calls to a Stored Procedure from another
2007# Stored Procedure crashes server
2008#
2009create table t1 (id1 int primary key, data1 int);
2010create table t2 (id2 int primary key, data2 int);
2011create procedure p1(IN id int, IN dt int)
2012begin
2013if (exists(select * from t1 where id1 = id and data1 = dt) or
2014not exists (select * from t2 where id2 = id and data2 = dt))
2015then
2016select 1;
2017end if;
2018end //
2019call p1(1,2);
20201
20211
2022call p1(1,2);
20231
20241
2025drop procedure p1;
2026create procedure p1(IN id int, IN dt int)
2027begin
2028case (exists(select * from t1 where id1 = id and data1 = dt) or
2029not exists (select * from t2 where id2 = id and data2 = dt))
2030when 1 then
2031select 1;
2032else
2033select 0;
2034end case;
2035end //
2036call p1(1,2);
20371
20381
2039call p1(1,2);
20401
20411
2042drop procedure p1;
2043create procedure p1(IN id int, IN dt int)
2044begin
2045declare wcont int default 1;
2046while (exists(select * from t1 where id1 = id and data1 = dt) or
2047not exists (select * from t2 where id2 = id and data2 = dt)) and wcont
2048do
2049select 1;
2050set wcont=0;
2051end while;
2052end //
2053call p1(1,2);
20541
20551
2056call p1(1,2);
20571
20581
2059drop procedure p1;
2060create procedure p1(IN id int, IN dt int)
2061begin
2062declare count int default 1;
2063repeat
2064select 1;
2065set count=count+1;
2066until (exists(select * from t1 where id1 = id and data1 = dt) or
2067not exists (select * from t2 where id2 = id and data2 = dt)) and
2068count < 3
2069end repeat;
2070end //
2071call p1(1,2);
20721
20731
2074call p1(1,2);
20751
20761
2077drop procedure p1;
2078create procedure p1(IN id int, IN dt int)
2079begin
2080for i in 1..(exists(select * from t1 where id1 = id and data1 = dt) or
2081not exists (select * from t2 where id2 = id and data2 = dt))
2082do
2083select 1;
2084end for;
2085end //
2086call p1(1,2);
20871
20881
2089call p1(1,2);
20901
20911
2092drop procedure p1;
2093drop table t1,t2;
2094# End of 10.4 tests
2095#
2096# Start of 10.5 tests
2097#
2098#
2099# MDEV-20734 Allow reserved keywords as user defined type names
2100#
2101CREATE TABLE t1 (a DUAL);
2102ERROR HY000: Unknown data type: 'DUAL'
2103SELECT CAST(1 AS DUAL);
2104ERROR HY000: Unknown data type: 'DUAL'
2105#
2106# MDEV-20735 Allow non-reserved keywords as user defined type names
2107#
2108CREATE TABLE t1 (a ASCII);
2109ERROR HY000: Unknown data type: 'ASCII'
2110SELECT CAST(1 AS ASCII);
2111ERROR HY000: Unknown data type: 'ASCII'
2112CREATE TABLE t1 (a LANGUAGE);
2113ERROR HY000: Unknown data type: 'LANGUAGE'
2114SELECT CAST(1 AS LANGUAGE);
2115ERROR HY000: Unknown data type: 'LANGUAGE'
2116CREATE TABLE t1 (a CLOSE);
2117ERROR HY000: Unknown data type: 'CLOSE'
2118SELECT CAST(1 AS CLOSE);
2119ERROR HY000: Unknown data type: 'CLOSE'
2120CREATE TABLE t1 (a NAMES);
2121ERROR HY000: Unknown data type: 'NAMES'
2122SELECT CAST(1 AS NAMES);
2123ERROR HY000: Unknown data type: 'NAMES'
2124CREATE TABLE t1 (a END);
2125ERROR HY000: Unknown data type: 'END'
2126SELECT CAST(1 AS END);
2127ERROR HY000: Unknown data type: 'END'
2128CREATE TABLE t1 (a GLOBAL);
2129ERROR HY000: Unknown data type: 'GLOBAL'
2130SELECT CAST(1 AS GLOBAL);
2131ERROR HY000: Unknown data type: 'GLOBAL'
2132CREATE TABLE t1 (a ACTION);
2133ERROR HY000: Unknown data type: 'ACTION'
2134SELECT CAST(1 AS ACTION);
2135ERROR HY000: Unknown data type: 'ACTION'
2136#
2137# End of 10.5 tests
2138#
2139