~vkolesnikov/qot/qot-server-connections

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
/* Copyright (C) 2000-2003 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; version 2 of the License.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/* sql_yacc.yy */

%
%union 

%

%pure_parser					/* We have threads */
/*
  Currently there is 287 shift/reduce conflict. We should not introduce
  new conflicts any more.
*/
%expect 286

/*
   Comments for TOKENS.
   For each token, please include in the same line a comment that contains
   the following tags:
   SQL-2003-R : Reserved keyword as per SQL-2003
   SQL-2003-N : Non Reserved keyword as per SQL-2003
   SQL-1999-R : Reserved keyword as per SQL-1999
   SQL-1999-N : Non Reserved keyword as per SQL-1999
   MYSQL      : MySQL extention (unspecified)
   MYSQL-FUNC : MySQL extention, function
   INTERNAL   : Not a real token, lex optimization
   OPERATOR   : SQL operator
   FUTURE-USE : Reserved for futur use

   This makes the code grep-able, and helps maintenance.
*/

%token  ABORT_SYM                     /* INTERNAL (used in lex) */
%token  ACCESSIBLE_SYM
%token  ACTION                        /* SQL-2003-N */
%token  ADD                           /* SQL-2003-R */
%token  ADDDATE_SYM                   /* MYSQL-FUNC */
%token  AFTER_SYM                     /* SQL-2003-N */
%token  AGAINST
%token  AGGREGATE_SYM
%token  ALGORITHM_SYM
%token  ALL                           /* SQL-2003-R */
%token  ALTER                         /* SQL-2003-R */
%token  ANALYZE_SYM
%token  AND_AND_SYM                   /* OPERATOR */
%token  AND_SYM                       /* SQL-2003-R */
%token  ANY_SYM                       /* SQL-2003-R */
%token  AS                            /* SQL-2003-R */
%token  ASC                           /* SQL-2003-N */
%token  ASCII_SYM                     /* MYSQL-FUNC */
%token  ASENSITIVE_SYM                /* FUTURE-USE */
%token  AT_SYM                        /* SQL-2003-R */
%token  AUTHORS_SYM
%token  AUTOEXTEND_SIZE_SYM
%token  AUTO_INC
%token  AVG_ROW_LENGTH
%token  AVG_SYM                       /* SQL-2003-N */
%token  BACKUP_SYM
%token  BEFORE_SYM                    /* SQL-2003-N */
%token  BEGIN_SYM                     /* SQL-2003-R */
%token  BETWEEN_SYM                   /* SQL-2003-R */
%token  BIGINT                        /* SQL-2003-R */
%token  BINARY                        /* SQL-2003-R */
%token  BINLOG_SYM
%token  BIN_NUM
%token  BIT_AND                       /* MYSQL-FUNC */
%token  BIT_OR                        /* MYSQL-FUNC */
%token  BIT_SYM                       /* MYSQL-FUNC */
%token  BIT_XOR                       /* MYSQL-FUNC */
%token  BLOB_SYM                      /* SQL-2003-R */
%token  BOOLEAN_SYM                   /* SQL-2003-R */
%token  BOOL_SYM
%token  BOTH                          /* SQL-2003-R */
%token  BTREE_SYM
%token  BY                            /* SQL-2003-R */
%token  BYTE_SYM
%token  CACHE_SYM
%token  CALL_SYM                      /* SQL-2003-R */
%token  CASCADE                       /* SQL-2003-N */
%token  CASCADED                      /* SQL-2003-R */
%token  CASE_SYM                      /* SQL-2003-R */
%token  CAST_SYM                      /* SQL-2003-R */
%token  CHAIN_SYM                     /* SQL-2003-N */
%token  CHANGE
%token  CHANGED
%token  CHARSET
%token  CHAR_SYM                      /* SQL-2003-R */
%token  CHECKSUM_SYM
%token  CHECK_SYM                     /* SQL-2003-R */
%token  CIPHER_SYM
%token  CLIENT_SYM
%token  CLOSE_SYM                     /* SQL-2003-R */
%token  COALESCE                      /* SQL-2003-N */
%token  CODE_SYM
%token  COLLATE_SYM                   /* SQL-2003-R */
%token  COLLATION_SYM                 /* SQL-2003-N */
%token  COLUMNS
%token  COLUMN_SYM                    /* SQL-2003-R */
%token  COMMENT_SYM
%token  COMMITTED_SYM                 /* SQL-2003-N */
%token  COMMIT_SYM                    /* SQL-2003-R */
%token  COMPACT_SYM
%token  COMPLETION_SYM
%token  COMPRESSED_SYM
%token  CONCURRENT
%token  CONDITION_SYM                 /* SQL-2003-N */
%token  CONNECTION_SYM
%token  CONSISTENT_SYM
%token  CONSTRAINT                    /* SQL-2003-R */
%token  CONTAINS_SYM                  /* SQL-2003-N */
%token  CONTINUE_SYM                  /* SQL-2003-R */
%token  CONTRIBUTORS_SYM
%token  CONVERT_SYM                   /* SQL-2003-N */
%token  COUNT_SYM                     /* SQL-2003-N */
%token  CREATE                        /* SQL-2003-R */
%token  CROSS                         /* SQL-2003-R */
%token  CUBE_SYM                      /* SQL-2003-R */
%token  CURDATE                       /* MYSQL-FUNC */
%token  CURRENT_USER                  /* SQL-2003-R */
%token  CURSOR_SYM                    /* SQL-2003-R */
%token  CURTIME                       /* MYSQL-FUNC */
%token  DATABASE
%token  DATABASES
%token  DATAFILE_SYM
%token  DATA_SYM                      /* SQL-2003-N */
%token  DATETIME
%token  DATE_ADD_INTERVAL             /* MYSQL-FUNC */
%token  DATE_SUB_INTERVAL             /* MYSQL-FUNC */
%token  DATE_SYM                      /* SQL-2003-R */
%token  DAY_HOUR_SYM
%token  DAY_MICROSECOND_SYM
%token  DAY_MINUTE_SYM
%token  DAY_SECOND_SYM
%token  DAY_SYM                       /* SQL-2003-R */
%token  DEALLOCATE_SYM                /* SQL-2003-R */
%token  DECIMAL_NUM
%token  DECIMAL_SYM                   /* SQL-2003-R */
%token  DECLARE_SYM                   /* SQL-2003-R */
%token  DEFAULT                       /* SQL-2003-R */
%token  DEFINER_SYM
%token  DELAYED_SYM
%token  DELAY_KEY_WRITE_SYM
%token  DELETE_SYM                    /* SQL-2003-R */
%token  DESC                          /* SQL-2003-N */
%token  DESCRIBE                      /* SQL-2003-R */
%token  DES_KEY_FILE
%token  DETERMINISTIC_SYM             /* SQL-2003-R */
%token  DIRECTORY_SYM
%token  DISABLE_SYM
%token  DISCARD
%token  DISK_SYM
%token  DISTINCT                      /* SQL-2003-R */
%token  DIV_SYM
%token  DOUBLE_SYM                    /* SQL-2003-R */
%token  DO_SYM
%token  DROP                          /* SQL-2003-R */
%token  DUAL_SYM
%token  DUMPFILE
%token  DUPLICATE_SYM
%token  DYNAMIC_SYM                   /* SQL-2003-R */
%token  EACH_SYM                      /* SQL-2003-R */
%token  ELSE                          /* SQL-2003-R */
%token  ELSEIF_SYM
%token  ENABLE_SYM
%token  ENCLOSED
%token  END                           /* SQL-2003-R */
%token  ENDS_SYM
%token  END_OF_INPUT                  /* INTERNAL */
%token  ENGINES_SYM
%token  ENGINE_SYM
%token  ENUM
%token  EQ                            /* OPERATOR */
%token  EQUAL_SYM                     /* OPERATOR */
%token  ERRORS
%token  ESCAPED
%token  ESCAPE_SYM                    /* SQL-2003-R */
%token  EVENTS_SYM
%token  EVENT_SYM
%token  EVERY_SYM                     /* SQL-2003-N */
%token  EXECUTE_SYM                   /* SQL-2003-R */
%token  EXISTS                        /* SQL-2003-R */
%token  EXIT_SYM
%token  EXPANSION_SYM
%token  EXTENDED_SYM
%token  EXTENT_SIZE_SYM
%token  EXTRACT_SYM                   /* SQL-2003-N */
%token  FALSE_SYM                     /* SQL-2003-R */
%token  FAST_SYM
%token  FETCH_SYM                     /* SQL-2003-R */
%token  FILE_SYM
%token  FIRST_SYM                     /* SQL-2003-N */
%token  FIXED_SYM
%token  FLOAT_NUM
%token  FLOAT_SYM                     /* SQL-2003-R */
%token  FLUSH_SYM
%token  FORCE_SYM
%token  FOREIGN                       /* SQL-2003-R */
%token  FOR_SYM                       /* SQL-2003-R */
%token  FOUND_SYM                     /* SQL-2003-R */
%token  FRAC_SECOND_SYM
%token  FROM
%token  FULL                          /* SQL-2003-R */
%token  FULLTEXT_SYM
%token  FUNCTION_SYM                  /* SQL-2003-R */
%token  GE
%token  GEOMETRYCOLLECTION
%token  GEOMETRY_SYM
%token  GET_FORMAT                    /* MYSQL-FUNC */
%token  GLOBAL_SYM                    /* SQL-2003-R */
%token  GRANT                         /* SQL-2003-R */
%token  GRANTS
%token  GROUP_SYM                     /* SQL-2003-R */
%token  GROUP_CONCAT_SYM
%token  GT_SYM                        /* OPERATOR */
%token  HANDLER_SYM
%token  HASH_SYM
%token  HAVING                        /* SQL-2003-R */
%token  HELP_SYM
%token  HEX_NUM
%token  HIGH_PRIORITY
%token  HOST_SYM
%token  HOSTS_SYM
%token  HOUR_MICROSECOND_SYM
%token  HOUR_MINUTE_SYM
%token  HOUR_SECOND_SYM
%token  HOUR_SYM                      /* SQL-2003-R */
%token  IDENT
%token  IDENTIFIED_SYM
%token  IDENT_QUOTED
%token  IF
%token  IGNORE_SYM
%token  IMPORT
%token  INDEXES
%token  INDEX_SYM
%token  INFILE
%token  INITIAL_SIZE_SYM
%token  INNER_SYM                     /* SQL-2003-R */
%token  INNOBASE_SYM
%token  INOUT_SYM                     /* SQL-2003-R */
%token  INSENSITIVE_SYM               /* SQL-2003-R */
%token  INSERT                        /* SQL-2003-R */
%token  INSERT_METHOD
%token  INSTALL_SYM
%token  INTERVAL_SYM                  /* SQL-2003-R */
%token  INTO                          /* SQL-2003-R */
%token  INT_SYM                       /* SQL-2003-R */
%token  INVOKER_SYM
%token  IN_SYM                        /* SQL-2003-R */
%token  IS                            /* SQL-2003-R */
%token  ISOLATION                     /* SQL-2003-R */
%token  ISSUER_SYM
%token  ITERATE_SYM
%token  JOIN_SYM                      /* SQL-2003-R */
%token  KEYS
%token  KEY_BLOCK_SIZE
%token  KEY_SYM                       /* SQL-2003-N */
%token  KILL_SYM
%token  LANGUAGE_SYM                  /* SQL-2003-R */
%token  LAST_SYM                      /* SQL-2003-N */
%token  LE                            /* OPERATOR */
%token  LEADING                       /* SQL-2003-R */
%token  LEAVES
%token  LEAVE_SYM
%token  LEFT                          /* SQL-2003-R */
%token  LESS_SYM
%token  LEVEL_SYM
%token  LEX_HOSTNAME
%token  LIKE                          /* SQL-2003-R */
%token  LIMIT
%token  LINEAR_SYM
%token  LINES
%token  LINESTRING
%token  LIST_SYM
%token  LOAD
%token  LOCAL_SYM                     /* SQL-2003-R */
%token  LOCATOR_SYM                   /* SQL-2003-N */
%token  LOCKS_SYM
%token  LOCK_SYM
%token  LOGFILE_SYM
%token  LOGS_SYM
%token  LONGBLOB
%token  LONGTEXT
%token  LONG_NUM
%token  LONG_SYM
%token  LOOP_SYM
%token  LOW_PRIORITY
%token  LT                            /* OPERATOR */
%token  MASTER_CONNECT_RETRY_SYM
%token  MASTER_HOST_SYM
%token  MASTER_LOG_FILE_SYM
%token  MASTER_LOG_POS_SYM
%token  MASTER_PASSWORD_SYM
%token  MASTER_PORT_SYM
%token  MASTER_SERVER_ID_SYM
%token  MASTER_SSL_CAPATH_SYM
%token  MASTER_SSL_CA_SYM
%token  MASTER_SSL_CERT_SYM
%token  MASTER_SSL_CIPHER_SYM
%token  MASTER_SSL_KEY_SYM
%token  MASTER_SSL_SYM
%token  MASTER_SSL_VERIFY_SERVER_CERT_SYM
%token  MASTER_SYM
%token  MASTER_USER_SYM
%token  MATCH                         /* SQL-2003-R */
%token  MAX_CONNECTIONS_PER_HOUR
%token  MAX_QUERIES_PER_HOUR
%token  MAX_ROWS
%token  MAX_SIZE_SYM
%token  MAX_SYM                       /* SQL-2003-N */
%token  MAX_UPDATES_PER_HOUR
%token  MAX_USER_CONNECTIONS_SYM
%token  MAX_VALUE_SYM                 /* SQL-2003-N */
%token  MEDIUMBLOB
%token  MEDIUMINT
%token  MEDIUMTEXT
%token  MEDIUM_SYM
%token  MEMORY_SYM
%token  MERGE_SYM                     /* SQL-2003-R */
%token  MICROSECOND_SYM               /* MYSQL-FUNC */
%token  MIGRATE_SYM
%token  MINUTE_MICROSECOND_SYM
%token  MINUTE_SECOND_SYM
%token  MINUTE_SYM                    /* SQL-2003-R */
%token  MIN_ROWS
%token  MIN_SYM                       /* SQL-2003-N */
%token  MODE_SYM
%token  MODIFIES_SYM                  /* SQL-2003-R */
%token  MODIFY_SYM
%token  MOD_SYM                       /* SQL-2003-N */
%token  MONTH_SYM                     /* SQL-2003-R */
%token  MULTILINESTRING
%token  MULTIPOINT
%token  MULTIPOLYGON
%token  MUTEX_SYM
%token  NAMES_SYM                     /* SQL-2003-N */
%token  NAME_SYM                      /* SQL-2003-N */
%token  NATIONAL_SYM                  /* SQL-2003-R */
%token  NATURAL                       /* SQL-2003-R */
%token  NCHAR_STRING
%token  NCHAR_SYM                     /* SQL-2003-R */
%token  NDBCLUSTER_SYM
%token  NE                            /* OPERATOR */
%token  NEG
%token  NEW_SYM                       /* SQL-2003-R */
%token  NEXT_SYM                      /* SQL-2003-N */
%token  NODEGROUP_SYM
%token  NONE_SYM                      /* SQL-2003-R */
%token  NOT2_SYM
%token  NOT_SYM                       /* SQL-2003-R */
%token  NOW_SYM
%token  NO_SYM                        /* SQL-2003-R */
%token  NO_WAIT_SYM
%token  NO_WRITE_TO_BINLOG
%token  NULL_SYM                      /* SQL-2003-R */
%token  NUM
%token  NUMERIC_SYM                   /* SQL-2003-R */
%token  NVARCHAR_SYM
%token  OFFSET_SYM
%token  OLD_PASSWORD
%token  ON                            /* SQL-2003-R */
%token  ONE_SHOT_SYM
%token  ONE_SYM
%token  OPEN_SYM                      /* SQL-2003-R */
%token  OPTIMIZE
%token  OPTIONS_SYM
%token  OPTION                        /* SQL-2003-N */
%token  OPTIONALLY
%token  OR2_SYM
%token  ORDER_SYM                     /* SQL-2003-R */
%token  OR_OR_SYM                     /* OPERATOR */
%token  OR_SYM                        /* SQL-2003-R */
%token  OUTER
%token  OUTFILE
%token  OUT_SYM                       /* SQL-2003-R */
%token  OWNER_SYM
%token  PACK_KEYS_SYM
%token  PARAM_MARKER
%token  PARSER_SYM
%token  PARTIAL                       /* SQL-2003-N */
%token  PARTITIONING_SYM
%token  PARTITIONS_SYM
%token  PARTITION_SYM                 /* SQL-2003-R */
%token  PASSWORD
%token  PHASE_SYM
%token  PLUGINS_SYM
%token  PLUGIN_SYM
%token  POINT_SYM
%token  POLYGON
%token  PORT_SYM
%token  POSITION_SYM                  /* SQL-2003-N */
%token  PRECISION                     /* SQL-2003-R */
%token  PREPARE_SYM                   /* SQL-2003-R */
%token  PRESERVE_SYM
%token  PREV_SYM
%token  PRIMARY_SYM                   /* SQL-2003-R */
%token  PRIVILEGES                    /* SQL-2003-N */
%token  PROCEDURE                     /* SQL-2003-R */
%token  PROCESS
%token  PROCESSLIST_SYM
%token  PURGE
%token  QUARTER_SYM
%token  QUERY_SYM
%token  QUICK
%token  RANGE_SYM                     /* SQL-2003-R */
%token  READS_SYM                     /* SQL-2003-R */
%token  READ_ONLY_SYM
%token  READ_SYM                      /* SQL-2003-N */
%token  READ_WRITE_SYM
%token  REAL                          /* SQL-2003-R */
%token  REBUILD_SYM
%token  RECOVER_SYM
%token  REDOFILE_SYM
%token  REDO_BUFFER_SIZE_SYM
%token  REDUNDANT_SYM
%token  REFERENCES                    /* SQL-2003-R */
%token  REGEXP
%token  RELAY_LOG_FILE_SYM
%token  RELAY_LOG_POS_SYM
%token  RELAY_THREAD
%token  RELEASE_SYM                   /* SQL-2003-R */
%token  RELOAD
%token  REMOVE_SYM
%token  RENAME
%token  REORGANIZE_SYM
%token  REPAIR
%token  REPEATABLE_SYM                /* SQL-2003-N */
%token  REPEAT_SYM                    /* MYSQL-FUNC */
%token  REPLACE                       /* MYSQL-FUNC */
%token  REPLICATION
%token  REQUIRE_SYM
%token  RESET_SYM
%token  RESOURCES
%token  RESTORE_SYM
%token  RESTRICT
%token  RESUME_SYM
%token  RETURNS_SYM                   /* SQL-2003-R */
%token  RETURN_SYM                    /* SQL-2003-R */
%token  REVOKE                        /* SQL-2003-R */
%token  RIGHT                         /* SQL-2003-R */
%token  ROLLBACK_SYM                  /* SQL-2003-R */
%token  ROLLUP_SYM                    /* SQL-2003-R */
%token  ROUTINE_SYM                   /* SQL-2003-N */
%token  ROWS_SYM                      /* SQL-2003-R */
%token  ROW_FORMAT_SYM
%token  ROW_SYM                       /* SQL-2003-R */
%token  RTREE_SYM
%token  SAVEPOINT_SYM                 /* SQL-2003-R */
%token  SCHEDULE_SYM
%token  SECOND_MICROSECOND_SYM
%token  SECOND_SYM                    /* SQL-2003-R */
%token  SECURITY_SYM                  /* SQL-2003-N */
%token  SELECT_SYM                    /* SQL-2003-R */
%token  SENSITIVE_SYM                 /* FUTURE-USE */
%token  SEPARATOR_SYM
%token  SERIALIZABLE_SYM              /* SQL-2003-N */
%token  SERIAL_SYM
%token  SESSION_SYM                   /* SQL-2003-N */
%token  SERVER_SYM
%token  SERVER_OPTIONS
%token  SET                           /* SQL-2003-R */
%token  SET_VAR
%token  SHARE_SYM
%token  SHIFT_LEFT                    /* OPERATOR */
%token  SHIFT_RIGHT                   /* OPERATOR */
%token  SHOW
%token  SHUTDOWN
%token  SIGNED_SYM
%token  SIMPLE_SYM                    /* SQL-2003-N */
%token  SLAVE
%token  SMALLINT                      /* SQL-2003-R */
%token  SNAPSHOT_SYM
%token  SOCKET_SYM
%token  SONAME_SYM
%token  SOUNDS_SYM
%token  SPATIAL_SYM
%token  SPECIFIC_SYM                  /* SQL-2003-R */
%token  SQLEXCEPTION_SYM              /* SQL-2003-R */
%token  SQLSTATE_SYM                  /* SQL-2003-R */
%token  SQLWARNING_SYM                /* SQL-2003-R */
%token  SQL_BIG_RESULT
%token  SQL_BUFFER_RESULT
%token  SQL_CACHE_SYM
%token  SQL_CALC_FOUND_ROWS
%token  SQL_NO_CACHE_SYM
%token  SQL_SMALL_RESULT
%token  SQL_SYM                       /* SQL-2003-R */
%token  SQL_THREAD
%token  SSL_SYM
%token  STARTING
%token  STARTS_SYM
%token  START_SYM                     /* SQL-2003-R */
%token  STATUS_SYM
%token  STDDEV_SAMP_SYM               /* SQL-2003-N */
%token  STD_SYM
%token  STOP_SYM
%token  STORAGE_SYM
%token  STRAIGHT_JOIN
%token  STRING_SYM
%token  SUBDATE_SYM
%token  SUBJECT_SYM
%token  SUBPARTITIONS_SYM
%token  SUBPARTITION_SYM
%token  SUBSTRING                     /* SQL-2003-N */
%token  SUM_SYM                       /* SQL-2003-N */
%token  SUPER_SYM
%token  SUSPEND_SYM
%token  SYSDATE
%token  TABLES
%token  TABLESPACE
%token  TABLE_REF_PRIORITY
%token  TABLE_SYM                     /* SQL-2003-R */
%token  TEMPORARY                     /* SQL-2003-N */
%token  TEMPTABLE_SYM
%token  TERMINATED
%token  TEXT_STRING
%token  TEXT_SYM
%token  THAN_SYM
%token  THEN_SYM                      /* SQL-2003-R */
%token  TIMESTAMP                     /* SQL-2003-R */
%token  TIMESTAMP_ADD
%token  TIMESTAMP_DIFF
%token  TIME_SYM                      /* SQL-2003-R */
%token  TINYBLOB
%token  TINYINT
%token  TINYTEXT
%token  TO_SYM                        /* SQL-2003-R */
%token  TRAILING                      /* SQL-2003-R */
%token  TRANSACTION_SYM
%token  TRIGGERS_SYM
%token  TRIGGER_SYM                   /* SQL-2003-R */
%token  TRIM                          /* SQL-2003-N */
%token  TRUE_SYM                      /* SQL-2003-R */
%token  TRUNCATE_SYM
%token  TYPES_SYM
%token  TYPE_SYM                      /* SQL-2003-N */
%token  UDF_RETURNS_SYM
%token  ULONGLONG_NUM
%token  UNCOMMITTED_SYM               /* SQL-2003-N */
%token  UNDEFINED_SYM
%token  UNDERSCORE_CHARSET
%token  UNDOFILE_SYM
%token  UNDO_BUFFER_SIZE_SYM
%token  UNDO_SYM                      /* FUTURE-USE */
%token  UNICODE_SYM
%token  UNINSTALL_SYM
%token  UNION_SYM                     /* SQL-2003-R */
%token  UNIQUE_SYM
%token  UNKNOWN_SYM                   /* SQL-2003-R */
%token  UNLOCK_SYM
%token  UNSIGNED
%token  UNTIL_SYM
%token  UPDATE_SYM                    /* SQL-2003-R */
%token  UPGRADE_SYM
%token  USAGE                         /* SQL-2003-N */
%token  USER                          /* SQL-2003-R */
%token  USE_FRM
%token  USE_SYM
%token  USING                         /* SQL-2003-R */
%token  UTC_DATE_SYM
%token  UTC_TIMESTAMP_SYM
%token  UTC_TIME_SYM
%token  VALUES                        /* SQL-2003-R */
%token  VALUE_SYM                     /* SQL-2003-R */
%token  VARBINARY
%token  VARCHAR                       /* SQL-2003-R */
%token  VARIABLES
%token  VARIANCE_SYM
%token  VARYING                       /* SQL-2003-R */
%token  VAR_SAMP_SYM
%token  VIEW_SYM                      /* SQL-2003-N */
%token  WAIT_SYM
%token  WARNINGS
%token  WEEK_SYM
%token  WHEN_SYM                      /* SQL-2003-R */
%token  WHERE                         /* SQL-2003-R */
%token  WHILE_SYM
%token  WITH                          /* SQL-2003-R */
%token  WORK_SYM                      /* SQL-2003-N */
%token  WRAPPER_SYM
%token  WRITE_SYM                     /* SQL-2003-N */
%token  X509_SYM
%token  XA_SYM
%token  XOR
%token  YEAR_MONTH_SYM
%token  YEAR_SYM                      /* SQL-2003-R */
%token  ZEROFILL

%left   JOIN_SYM INNER_SYM STRAIGHT_JOIN CROSS LEFT RIGHT
/* A dummy token to force the priority of table_ref production in a join. */
%left   TABLE_REF_PRIORITY
%left   SET_VAR
%left	OR_OR_SYM OR_SYM OR2_SYM XOR
%left	AND_SYM AND_AND_SYM
%left	BETWEEN_SYM CASE_SYM WHEN_SYM THEN_SYM ELSE
%left	EQ EQUAL_SYM GE GT_SYM LE LT NE IS LIKE REGEXP IN_SYM
%left	'|'
%left	'&'
%left	SHIFT_LEFT SHIFT_RIGHT
%left	'-' '+'
%left	'*' '/' '%' DIV_SYM MOD_SYM
%left   '^'
%left	NEG '~'
%right	NOT_SYM NOT2_SYM
%right	BINARY COLLATE_SYM

%type <lex_str>
        IDENT IDENT_QUOTED TEXT_STRING DECIMAL_NUM FLOAT_NUM NUM LONG_NUM HEX_NUM
	LEX_HOSTNAME ULONGLONG_NUM field_ident select_alias ident ident_or_text
        UNDERSCORE_CHARSET IDENT_sys TEXT_STRING_sys TEXT_STRING_literal
	NCHAR_STRING opt_component key_cache_name
        sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty

%type <lex_str_ptr>
	opt_table_alias

%type <table>
	table_ident table_ident_nodb references xid

%type <simple_string>
	remember_name remember_end opt_ident opt_db text_or_password
	opt_constraint constraint

%type <string>
	text_string opt_gconcat_separator

%type <num>
	type int_type real_type order_dir lock_option
	udf_type if_exists opt_local opt_table_options table_options
        table_option opt_if_not_exists opt_no_write_to_binlog
        delete_option opt_temporary all_or_any opt_distinct
        opt_ignore_leaves fulltext_options spatial_type union_option
        start_transaction_opts opt_chain opt_release
        union_opt select_derived_init option_type2
        opt_natural_language_mode opt_query_expansion
        opt_ev_status opt_ev_on_completion ev_on_completion opt_ev_comment
        ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_sql_stmt

%type <ulong_num>
	ulong_num real_ulong_num merge_insert_types

%type <ulonglong_number>
	ulonglong_num real_ulonglong_num size_number

%type <p_elem_value>
        part_bit_expr

%type <lock_type>
	replace_lock_option opt_low_priority insert_lock_option load_data_lock

%type <item>
	literal text_literal insert_ident order_ident
	simple_ident select_item2 expr opt_expr opt_else sum_expr in_sum_expr
	variable variable_aux bool_term bool_factor bool_test bool_pri 
	predicate bit_expr bit_term bit_factor value_expr term factor
	table_wild simple_expr udf_expr
	expr_or_default set_expr_or_default interval_expr
	param_marker geometry_function
	signed_literal now_or_signed_literal opt_escape
	sp_opt_default
	simple_ident_nospvar simple_ident_q
        field_or_var limit_option
        part_func_expr
        function_call_keyword
        function_call_nonkeyword
        function_call_generic
        function_call_conflict

%type <item_num>
	NUM_literal

%type <item_list>
	expr_list udf_expr_list udf_expr_list2 when_list
	ident_list ident_list_arg opt_expr_list

%type <var_type>
        option_type opt_var_type opt_var_ident_type

%type <key_type>
	key_type opt_unique_or_fulltext constraint_key_type

%type <key_alg>
	btree_or_rtree

%type <string_list>
	using_list

%type <key_part>
	key_part

%type <table_list>
	join_table_list  join_table
        table_factor table_ref
        select_derived derived_table_list

%type <date_time_type> date_time_type;
%type <interval> interval

%type <interval_time_st> interval_time_st

%type <db_type> storage_engines known_storage_engines

%type <row_type> row_types

%type <tx_isolation> isolation_types

%type <ha_rkey_mode> handler_rkey_mode

%type <cast_type> cast_type

%type <udf_type> udf_func_type

%type <symbol> keyword keyword_sp

%type <lex_user> user grant_user

%type <charset>
	opt_collate
	charset_name
	charset_name_or_default
	old_or_new_charset_name
	old_or_new_charset_name_or_default
	collation_name
	collation_name_or_default
	opt_load_data_charset

%type <variable> internal_variable_name

%type <select_lex> subselect subselect_init
	get_select_lex

%type <boolfunc2creator> comp_op

%type <NONE>
	query verb_clause create change select do drop insert replace insert2
	insert_values update delete truncate rename
	show describe load alter optimize keycache preload flush
	reset purge begin commit rollback savepoint release
	slave master_def master_defs master_file_def slave_until_opts
	repair restore backup analyze check start checksum
	field_list field_list_item field_spec kill column_def key_def
	keycache_list assign_to_keycache preload_list preload_keys
	select_item_list select_item values_list no_braces
	opt_limit_clause delete_limit_clause fields opt_values values
	procedure_list procedure_list2 procedure_item
	expr_list2 udf_expr_list3 handler
	opt_precision opt_ignore opt_column opt_restrict
	grant revoke set lock unlock string_list field_options field_option
	field_opt_list opt_binary table_lock_list table_lock
	ref_list opt_on_delete opt_on_delete_list opt_on_delete_item use
	opt_delete_options opt_delete_option varchar nchar nvarchar
	opt_outer table_list table_name opt_option opt_place
	opt_attribute opt_attribute_list attribute column_list column_list_id
	opt_column_list grant_privileges grant_ident grant_list grant_option
	object_privilege object_privilege_list user_list rename_list
	clear_privileges flush_options flush_option
	equal optional_braces
	opt_mi_check_type opt_to mi_check_types normal_join
	db_to_db table_to_table_list table_to_table opt_table_list opt_as
	handler_rkey_function handler_read_or_scan
	single_multi table_wild_list table_wild_one opt_wild
	union_clause union_list
	precision subselect_start opt_and charset
	subselect_end select_var_list select_var_list_init help opt_len
	opt_extended_describe
        prepare prepare_src execute deallocate
	statement sp_suid
	sp_c_chistics sp_a_chistics sp_chistic sp_c_chistic xa
        load_data opt_field_or_var_spec fields_or_vars opt_load_data_set_spec
        definer view_replace_or_algorithm view_replace
        view_algorithm view_or_trigger_or_sp_or_event
        view_or_trigger_or_sp_or_event_tail
        view_suid view_tail view_list_opt view_list view_select
        view_check_option trigger_tail sp_tail
        install uninstall partition_entry binlog_base64_event
	init_key_options key_options key_opts key_opt key_using_alg
        server_def server_options_list server_option
END_OF_INPUT

%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
%type <NONE> sp_proc_stmt_statement sp_proc_stmt_return
%type <NONE> sp_proc_stmt_if
%type <NONE> sp_labeled_control sp_proc_stmt_unlabeled sp_proc_stmt_leave
%type <NONE> sp_proc_stmt_iterate
%type <NONE> sp_proc_stmt_open sp_proc_stmt_fetch sp_proc_stmt_close
%type <NONE> case_stmt_specification simple_case_stmt searched_case_stmt

%type <num>  sp_decl_idents sp_opt_inout sp_handler_type sp_hcond_list
%type <spcondtype> sp_cond sp_hcond
%type <spblock> sp_decls sp_decl
%type <lex> sp_cursor_stmt
%type <spname> sp_name
%type <index_hint> index_hint_type
%type <num> index_hint_clause

%type <NONE>
	'-' '+' '*' '/' '%' '(' ')'
	',' '!' '' '' '&' '|' AND_SYM OR_SYM OR_OR_SYM BETWEEN_SYM CASE_SYM
	THEN_SYM WHEN_SYM DIV_SYM MOD_SYM OR2_SYM AND_AND_SYM
%%

query:
  END_OF_INPUT
| verb_clause END_OF_INPUT;

verb_clause:
  statement
| begin;

statement:
  alter
| analyze
| backup
| binlog_base64_event
| call
| change
| check
| checksum
| commit
| create
| deallocate
| delete
| describe
| do
| drop
| execute
| flush
| grant
| handler
| help
| insert
| install
| kill
| load
| lock
| optimize
| keycache
| partition_entry
| preload
| prepare
| purge
| release
| rename
| repair
| replace
| reset
| restore
| revoke
| rollback
| savepoint
| select
| set
| show
| slave
| start
| truncate
| uninstall
| unlock
| update
| use
| xa;

deallocate:
  deallocate_or_drop PREPARE_SYM ident;

deallocate_or_drop:
  DEALLOCATE_SYM
| DROP;

prepare:
  PREPARE_SYM ident FROM prepare_src;

prepare_src:
  TEXT_STRING_sys
| '@' ident_or_text;

execute:
  EXECUTE_SYM ident execute_using;

execute_using:
 
| USING execute_var_list;

execute_var_list:
  execute_var_list ',' execute_var_ident
| execute_var_ident;

execute_var_ident:
  '@' ident_or_text;

help:
  HELP_SYM ident_or_text;

change:
  CHANGE MASTER_SYM TO_SYM master_defs;

master_defs:
  master_def
| master_defs ',' master_def;

master_def:
  MASTER_HOST_SYM EQ TEXT_STRING_sys
| MASTER_USER_SYM EQ TEXT_STRING_sys
| MASTER_PASSWORD_SYM EQ TEXT_STRING_sys
| MASTER_PORT_SYM EQ ulong_num
| MASTER_CONNECT_RETRY_SYM EQ ulong_num
| MASTER_SSL_SYM EQ ulong_num
| MASTER_SSL_CA_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CAPATH_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CERT_SYM EQ TEXT_STRING_sys
| MASTER_SSL_CIPHER_SYM EQ TEXT_STRING_sys
| MASTER_SSL_KEY_SYM EQ TEXT_STRING_sys
| MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
| master_file_def;

master_file_def:
  MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys
| MASTER_LOG_POS_SYM EQ ulonglong_num
| RELAY_LOG_FILE_SYM EQ TEXT_STRING_sys
| RELAY_LOG_POS_SYM EQ ulong_num;

create:
  CREATE opt_table_options TABLE_SYM opt_if_not_exists table_ident create2
| CREATE opt_unique_or_fulltext INDEX_SYM ident key_alg ON table_ident '(' key_list ')' key_options
| CREATE DATABASE opt_if_not_exists ident opt_create_database_options
| CREATE view_or_trigger_or_sp_or_event
| CREATE USER clear_privileges grant_list
| CREATE LOGFILE_SYM GROUP_SYM logfile_group_info
| CREATE TABLESPACE tablespace_info
| CREATE server_def;

server_def:
  SERVER_SYM ident_or_text FOREIGN DATA_SYM WRAPPER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')';

server_options_list:
  server_option
| server_options_list ',' server_option;

server_option:
  USER TEXT_STRING_sys
| HOST_SYM TEXT_STRING_sys
| DATABASE TEXT_STRING_sys
| OWNER_SYM TEXT_STRING_sys
| PASSWORD TEXT_STRING_sys
| SOCKET_SYM TEXT_STRING_sys
| PORT_SYM ulong_num;

event_tail:
  EVENT_SYM opt_if_not_exists sp_name ON SCHEDULE_SYM ev_schedule_time opt_ev_on_completion opt_ev_status opt_ev_comment DO_SYM ev_sql_stmt;

ev_schedule_time:
  EVERY_SYM expr interval ev_starts ev_ends
| AT_SYM expr;

opt_ev_status:
 
| ENABLE_SYM
| DISABLE_SYM ON SLAVE
| DISABLE_SYM;

ev_starts:
 
| STARTS_SYM expr;

ev_ends:
 
| ENDS_SYM expr;

opt_ev_on_completion:
 
| ev_on_completion;

ev_on_completion:
  ON COMPLETION_SYM PRESERVE_SYM
| ON COMPLETION_SYM NOT_SYM PRESERVE_SYM;

opt_ev_comment:
 
| COMMENT_SYM TEXT_STRING_sys;

ev_sql_stmt:
  ev_sql_stmt_inner;

ev_sql_stmt_inner:
  sp_proc_stmt_statement
| sp_proc_stmt_return
| sp_proc_stmt_if
| case_stmt_specification
| sp_labeled_control
| sp_proc_stmt_unlabeled
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close;

clear_privileges:
 ;

sp_name:
  ident '.' ident
| ident;

create_function_tail:
  RETURNS_SYM udf_type SONAME_SYM TEXT_STRING_sys
| '(' sp_fdparam_list ')' RETURNS_SYM type sp_c_chistics sp_proc_stmt;

sp_a_chistics:
 
| sp_a_chistics sp_chistic;

sp_c_chistics:
 
| sp_c_chistics sp_c_chistic;

sp_chistic:
  COMMENT_SYM TEXT_STRING_sys
| LANGUAGE_SYM SQL_SYM
| NO_SYM SQL_SYM
| CONTAINS_SYM SQL_SYM
| READS_SYM SQL_SYM DATA_SYM
| MODIFIES_SYM SQL_SYM DATA_SYM
| sp_suid;

sp_c_chistic:
  sp_chistic
| DETERMINISTIC_SYM
| not DETERMINISTIC_SYM;

sp_suid:
  SQL_SYM SECURITY_SYM DEFINER_SYM
| SQL_SYM SECURITY_SYM INVOKER_SYM;

call:
  CALL_SYM sp_name opt_sp_cparam_list;

opt_sp_cparam_list:
 
| '(' opt_sp_cparams ')';

opt_sp_cparams:
 
| sp_cparams;

sp_cparams:
  sp_cparams ',' expr
| expr;

sp_fdparam_list:
 
| sp_fdparams;

sp_fdparams:
  sp_fdparams ',' sp_fdparam
| sp_fdparam;

sp_init_param:
 ;

sp_fdparam:
  ident sp_init_param type;

sp_pdparam_list:
 
| sp_pdparams;

sp_pdparams:
  sp_pdparams ',' sp_pdparam
| sp_pdparam;

sp_pdparam:
  sp_opt_inout sp_init_param ident type;

sp_opt_inout:
 
| IN_SYM
| OUT_SYM
| INOUT_SYM;

sp_proc_stmts:
 
| sp_proc_stmts sp_proc_stmt ';';

sp_proc_stmts1:
  sp_proc_stmt ';'
| sp_proc_stmts1 sp_proc_stmt ';';

sp_decls:
 
| sp_decls sp_decl ';';

sp_decl:
  DECLARE_SYM sp_decl_idents type sp_opt_default
| DECLARE_SYM ident CONDITION_SYM FOR_SYM sp_cond
| DECLARE_SYM sp_handler_type HANDLER_SYM FOR_SYM sp_hcond_list sp_proc_stmt
| DECLARE_SYM ident CURSOR_SYM FOR_SYM sp_cursor_stmt;

sp_cursor_stmt:
  statement;

sp_handler_type:
  EXIT_SYM
| CONTINUE_SYM;

sp_hcond_list:
  sp_hcond_element
| sp_hcond_list ',' sp_hcond_element;

sp_hcond_element:
  sp_hcond;

sp_cond:
  ulong_num
| SQLSTATE_SYM opt_value TEXT_STRING_literal;

opt_value:
 
| VALUE_SYM;

sp_hcond:
  sp_cond
| ident
| SQLWARNING_SYM
| not FOUND_SYM
| SQLEXCEPTION_SYM;

sp_decl_idents:
  ident
| sp_decl_idents ',' ident;

sp_opt_default:
 
| DEFAULT expr;

sp_proc_stmt:
  sp_proc_stmt_statement
| sp_proc_stmt_return
| sp_proc_stmt_if
| case_stmt_specification
| sp_labeled_control
| sp_proc_stmt_unlabeled
| sp_proc_stmt_leave
| sp_proc_stmt_iterate
| sp_proc_stmt_open
| sp_proc_stmt_fetch
| sp_proc_stmt_close;

sp_proc_stmt_if:
  IF sp_if END IF;

sp_proc_stmt_statement:
  statement;

sp_proc_stmt_return:
  RETURN_SYM expr;

sp_proc_stmt_unlabeled:
  sp_unlabeled_control;

sp_proc_stmt_leave:
  LEAVE_SYM label_ident;

sp_proc_stmt_iterate:
  ITERATE_SYM label_ident;

sp_proc_stmt_open:
  OPEN_SYM ident;

sp_proc_stmt_fetch:
  FETCH_SYM sp_opt_fetch_noise ident INTO sp_fetch_list;

sp_proc_stmt_close:
  CLOSE_SYM ident;

sp_opt_fetch_noise:
 
| NEXT_SYM FROM
| FROM;

sp_fetch_list:
  ident
| sp_fetch_list ',' ident;

sp_if:
  expr THEN_SYM sp_proc_stmts1 sp_elseifs;

sp_elseifs:
 
| ELSEIF_SYM sp_if
| ELSE sp_proc_stmts1;

case_stmt_specification:
  simple_case_stmt
| searched_case_stmt;

simple_case_stmt:
  CASE_SYM expr simple_when_clause_list else_clause_opt END CASE_SYM;

searched_case_stmt:
  CASE_SYM searched_when_clause_list else_clause_opt END CASE_SYM;

simple_when_clause_list:
  simple_when_clause
| simple_when_clause_list simple_when_clause;

searched_when_clause_list:
  searched_when_clause
| searched_when_clause_list searched_when_clause;

simple_when_clause:
  WHEN_SYM expr THEN_SYM sp_proc_stmts1;

searched_when_clause:
  WHEN_SYM expr THEN_SYM sp_proc_stmts1;

else_clause_opt:
 
| ELSE sp_proc_stmts1;

sp_labeled_control:
  label_ident ':' sp_unlabeled_control sp_opt_label;

sp_opt_label:
 
| label_ident;

sp_unlabeled_control:
  BEGIN_SYM sp_decls sp_proc_stmts END
| LOOP_SYM sp_proc_stmts1 END LOOP_SYM
| WHILE_SYM expr DO_SYM sp_proc_stmts1 END WHILE_SYM
| REPEAT_SYM sp_proc_stmts1 UNTIL_SYM expr END REPEAT_SYM;

trg_action_time:
  BEFORE_SYM
| AFTER_SYM;

trg_event:
  INSERT
| UPDATE_SYM
| DELETE_SYM;

change_tablespace_access:
  tablespace_name ts_access_mode;

change_tablespace_info:
  tablespace_name CHANGE ts_datafile change_ts_option_list;

tablespace_info:
  tablespace_name ADD ts_datafile opt_logfile_group_name tablespace_option_list;

opt_logfile_group_name:
 
| USE_SYM LOGFILE_SYM GROUP_SYM ident;

alter_tablespace_info:
  tablespace_name ADD ts_datafile alter_tablespace_option_list
| tablespace_name DROP ts_datafile alter_tablespace_option_list;

logfile_group_info:
  logfile_group_name add_log_file logfile_group_option_list;

alter_logfile_group_info:
  logfile_group_name add_log_file alter_logfile_group_option_list;

add_log_file:
  ADD lg_undofile
| ADD lg_redofile;

change_ts_option_list:
  change_ts_options;

change_ts_options:
  change_ts_option
| change_ts_options change_ts_option
| change_ts_options ',' change_ts_option;

change_ts_option:
  opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size;

tablespace_option_list:
  tablespace_options;

tablespace_options:
  tablespace_option
| tablespace_options tablespace_option
| tablespace_options ',' tablespace_option;

tablespace_option:
  opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size
| opt_ts_extent_size
| opt_ts_nodegroup
| opt_ts_engine
| ts_wait
| opt_ts_comment;

alter_tablespace_option_list:
  alter_tablespace_options;

alter_tablespace_options:
  alter_tablespace_option
| alter_tablespace_options alter_tablespace_option
| alter_tablespace_options ',' alter_tablespace_option;

alter_tablespace_option:
  opt_ts_initial_size
| opt_ts_autoextend_size
| opt_ts_max_size
| opt_ts_engine
| ts_wait;

logfile_group_option_list:
  logfile_group_options;

logfile_group_options:
  logfile_group_option
| logfile_group_options logfile_group_option
| logfile_group_options ',' logfile_group_option;

logfile_group_option:
  opt_ts_initial_size
| opt_ts_undo_buffer_size
| opt_ts_redo_buffer_size
| opt_ts_nodegroup
| opt_ts_engine
| ts_wait
| opt_ts_comment;

alter_logfile_group_option_list:
  alter_logfile_group_options;

alter_logfile_group_options:
  alter_logfile_group_option
| alter_logfile_group_options alter_logfile_group_option
| alter_logfile_group_options ',' alter_logfile_group_option;

alter_logfile_group_option:
  opt_ts_initial_size
| opt_ts_engine
| ts_wait;

ts_datafile:
  DATAFILE_SYM TEXT_STRING_sys;

lg_undofile:
  UNDOFILE_SYM TEXT_STRING_sys;

lg_redofile:
  REDOFILE_SYM TEXT_STRING_sys;

tablespace_name:
  ident;

logfile_group_name:
  ident;

ts_access_mode:
  READ_ONLY_SYM
| READ_WRITE_SYM
| NOT_SYM ACCESSIBLE_SYM;

opt_ts_initial_size:
  INITIAL_SIZE_SYM opt_equal size_number;

opt_ts_autoextend_size:
  AUTOEXTEND_SIZE_SYM opt_equal size_number;

opt_ts_max_size:
  MAX_SIZE_SYM opt_equal size_number;

opt_ts_extent_size:
  EXTENT_SIZE_SYM opt_equal size_number;

opt_ts_undo_buffer_size:
  UNDO_BUFFER_SIZE_SYM opt_equal size_number;

opt_ts_redo_buffer_size:
  REDO_BUFFER_SIZE_SYM opt_equal size_number;

opt_ts_nodegroup:
  NODEGROUP_SYM opt_equal real_ulong_num;

opt_ts_comment:
  COMMENT_SYM opt_equal TEXT_STRING_sys;

opt_ts_engine:
  opt_storage ENGINE_SYM opt_equal storage_engines;

opt_ts_wait:
 
| ts_wait;

ts_wait:
  WAIT_SYM
| NO_WAIT_SYM;

size_number:
  real_ulong_num
| IDENT;

create2:
  '(' create2a
| opt_create_table_options opt_partitioning create3
| LIKE table_ident
| '(' LIKE table_ident ')';

create2a:
  field_list ')' opt_create_table_options opt_partitioning create3
| opt_partitioning create_select ')' union_opt;

create3:
 
| opt_duplicate opt_as create_select union_clause
| opt_duplicate opt_as '(' create_select ')' union_opt;

opt_partitioning:
 
| partitioning;

partitioning:
  PARTITION_SYM partition;

partition_entry:
  PARTITION_SYM partition;

partition:
  BY part_type_def opt_no_parts opt_sub_part part_defs;

part_type_def:
  opt_linear KEY_SYM '(' part_field_list ')'
| opt_linear HASH_SYM part_func
| RANGE_SYM part_func
| LIST_SYM part_func;

opt_linear:
 
| LINEAR_SYM;

part_field_list:
 
| part_field_item_list;

part_field_item_list:
  part_field_item
| part_field_item_list ',' part_field_item;

part_field_item:
  ident;

part_func:
  '(' remember_name part_func_expr remember_end ')';

sub_part_func:
  '(' remember_name part_func_expr remember_end ')';

opt_no_parts:
 
| PARTITIONS_SYM real_ulong_num;

opt_sub_part:
 
| SUBPARTITION_SYM BY opt_linear HASH_SYM sub_part_func opt_no_subparts
| SUBPARTITION_SYM BY opt_linear KEY_SYM '(' sub_part_field_list ')' opt_no_subparts;

sub_part_field_list:
  sub_part_field_item
| sub_part_field_list ',' sub_part_field_item;

sub_part_field_item:
  ident;

part_func_expr:
  bit_expr;

opt_no_subparts:
 
| SUBPARTITIONS_SYM real_ulong_num;

part_defs:
 
| '(' part_def_list ')';

part_def_list:
  part_definition
| part_def_list ',' part_definition;

part_definition:
  PARTITION_SYM part_name opt_part_values opt_part_options opt_sub_partition;

part_name:
  ident;

opt_part_values:
 
| VALUES LESS_SYM THAN_SYM part_func_max
| VALUES IN_SYM '(' part_list_func ')';

part_func_max:
  max_value_sym
| part_range_func;

max_value_sym:
  MAX_VALUE_SYM
| '(' MAX_VALUE_SYM ')';

part_range_func:
  '(' part_bit_expr ')';

part_list_func:
  part_list_item
| part_list_func ',' part_list_item;

part_list_item:
  part_bit_expr;

part_bit_expr:
  bit_expr;

opt_sub_partition:
 
| '(' sub_part_list ')';

sub_part_list:
  sub_part_definition
| sub_part_list ',' sub_part_definition;

sub_part_definition:
  SUBPARTITION_SYM sub_name opt_part_options;

sub_name:
  ident_or_text;

opt_part_options:
 
| opt_part_option_list;

opt_part_option_list:
  opt_part_option_list opt_part_option
| opt_part_option;

opt_part_option:
  TABLESPACE opt_equal ident_or_text
| opt_storage ENGINE_SYM opt_equal storage_engines
| NODEGROUP_SYM opt_equal real_ulong_num
| MAX_ROWS opt_equal real_ulonglong_num
| MIN_ROWS opt_equal real_ulonglong_num
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| COMMENT_SYM opt_equal TEXT_STRING_sys;

create_select:
  SELECT_SYM select_options select_item_list opt_select_from;

opt_as:
 
| AS;

opt_create_database_options:
 
| create_database_options;

create_database_options:
  create_database_option
| create_database_options create_database_option;

create_database_option:
  default_collation
| default_charset;

opt_table_options:
 
| table_options;

table_options:
  table_option
| table_option table_options;

table_option:
  TEMPORARY;

opt_if_not_exists:
 
| IF not EXISTS;

opt_create_table_options:
 
| create_table_options;

create_table_options_space_separated:
  create_table_option
| create_table_option create_table_options_space_separated;

create_table_options:
  create_table_option
| create_table_option create_table_options
| create_table_option ',' create_table_options;

create_table_option:
  ENGINE_SYM opt_equal storage_engines
| TYPE_SYM opt_equal storage_engines
| MAX_ROWS opt_equal ulonglong_num
| MIN_ROWS opt_equal ulonglong_num
| AVG_ROW_LENGTH opt_equal ulong_num
| PASSWORD opt_equal TEXT_STRING_sys
| COMMENT_SYM opt_equal TEXT_STRING_sys
| AUTO_INC opt_equal ulonglong_num
| PACK_KEYS_SYM opt_equal ulong_num
| PACK_KEYS_SYM opt_equal DEFAULT
| CHECKSUM_SYM opt_equal ulong_num
| DELAY_KEY_WRITE_SYM opt_equal ulong_num
| ROW_FORMAT_SYM opt_equal row_types
| UNION_SYM opt_equal '(' table_list ')'
| default_charset
| default_collation
| INSERT_METHOD opt_equal merge_insert_types
| DATA_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| INDEX_SYM DIRECTORY_SYM opt_equal TEXT_STRING_sys
| TABLESPACE ident
| STORAGE_SYM DISK_SYM
| STORAGE_SYM MEMORY_SYM
| CONNECTION_SYM opt_equal TEXT_STRING_sys
| KEY_BLOCK_SIZE opt_equal ulong_num;

default_charset:
  opt_default charset opt_equal charset_name_or_default;

default_collation:
  opt_default COLLATE_SYM opt_equal collation_name_or_default;

storage_engines:
  ident_or_text;

known_storage_engines:
  ident_or_text;

row_types:
  DEFAULT
| FIXED_SYM
| DYNAMIC_SYM
| COMPRESSED_SYM
| REDUNDANT_SYM
| COMPACT_SYM;

merge_insert_types:
  NO_SYM
| FIRST_SYM
| LAST_SYM;

opt_select_from:
  opt_limit_clause
| select_from select_lock_type;

udf_func_type:
 
| AGGREGATE_SYM;

udf_type:
  STRING_SYM
| REAL
| DECIMAL_SYM
| INT_SYM;

field_list:
  field_list_item
| field_list ',' field_list_item;

field_list_item:
  column_def
| key_def;

column_def:
  field_spec opt_check_constraint
| field_spec references;

key_def:
  key_type opt_ident key_alg '(' key_list ')' key_options
| opt_constraint constraint_key_type opt_ident key_alg '(' key_list ')' key_options
| opt_constraint FOREIGN KEY_SYM opt_ident '(' key_list ')' references
| constraint opt_check_constraint
| opt_constraint check_constraint;

opt_check_constraint:
 
| check_constraint;

check_constraint:
  CHECK_SYM expr;

opt_constraint:
 
| constraint;

constraint:
  CONSTRAINT opt_ident;

field_spec:
  field_ident type opt_attribute;

type:
  int_type opt_len field_options
| real_type opt_precision field_options
| FLOAT_SYM float_options field_options
| BIT_SYM
| BIT_SYM '(' NUM ')'
| BOOL_SYM
| BOOLEAN_SYM
| char '(' NUM ')' opt_binary
| char opt_binary
| nchar '(' NUM ')' opt_bin_mod
| nchar opt_bin_mod
| BINARY '(' NUM ')'
| BINARY
| varchar '(' NUM ')' opt_binary
| nvarchar '(' NUM ')' opt_bin_mod
| VARBINARY '(' NUM ')'
| YEAR_SYM opt_len field_options
| DATE_SYM
| TIME_SYM
| TIMESTAMP opt_len
| DATETIME
| TINYBLOB
| BLOB_SYM opt_len
| spatial_type
| MEDIUMBLOB
| LONGBLOB
| LONG_SYM VARBINARY
| LONG_SYM varchar opt_binary
| TINYTEXT opt_binary
| TEXT_SYM opt_len opt_binary
| MEDIUMTEXT opt_binary
| LONGTEXT opt_binary
| DECIMAL_SYM float_options field_options
| NUMERIC_SYM float_options field_options
| FIXED_SYM float_options field_options
| ENUM '(' string_list ')' opt_binary
| SET '(' string_list ')' opt_binary
| LONG_SYM opt_binary
| SERIAL_SYM;

spatial_type:
  GEOMETRY_SYM
| GEOMETRYCOLLECTION
| POINT_SYM
| MULTIPOINT
| LINESTRING
| MULTILINESTRING
| POLYGON
| MULTIPOLYGON;

char:
  CHAR_SYM;

nchar:
  NCHAR_SYM
| NATIONAL_SYM CHAR_SYM;

varchar:
  char VARYING
| VARCHAR;

nvarchar:
  NATIONAL_SYM VARCHAR
| NVARCHAR_SYM
| NCHAR_SYM VARCHAR
| NATIONAL_SYM CHAR_SYM VARYING
| NCHAR_SYM VARYING;

int_type:
  INT_SYM
| TINYINT
| SMALLINT
| MEDIUMINT
| BIGINT;

real_type:
  REAL
| DOUBLE_SYM
| DOUBLE_SYM PRECISION;

float_options:
 
| '(' NUM ')'
| precision;

precision:
  '(' NUM ',' NUM ')';

field_options:
 
| field_opt_list;

field_opt_list:
  field_opt_list field_option
| field_option;

field_option:
  SIGNED_SYM
| UNSIGNED
| ZEROFILL;

opt_len:
 
| '(' NUM ')';

opt_precision:
 
| precision;

opt_attribute:
 
| opt_attribute_list;

opt_attribute_list:
  opt_attribute_list attribute
| attribute;

attribute:
  NULL_SYM
| not NULL_SYM
| DEFAULT now_or_signed_literal
| ON UPDATE_SYM NOW_SYM optional_braces
| AUTO_INC
| SERIAL_SYM DEFAULT VALUE_SYM
| opt_primary KEY_SYM
| UNIQUE_SYM
| UNIQUE_SYM KEY_SYM
| COMMENT_SYM TEXT_STRING_sys
| COLLATE_SYM collation_name;

now_or_signed_literal:
  NOW_SYM optional_braces
| signed_literal;

charset:
  CHAR_SYM SET
| CHARSET;

charset_name:
  ident_or_text
| BINARY;

charset_name_or_default:
  charset_name
| DEFAULT;

opt_load_data_charset:
 
| charset charset_name_or_default;

old_or_new_charset_name:
  ident_or_text
| BINARY;

old_or_new_charset_name_or_default:
  old_or_new_charset_name
| DEFAULT;

collation_name:
  ident_or_text;

opt_collate:
 
| COLLATE_SYM collation_name_or_default;

collation_name_or_default:
  collation_name
| DEFAULT;

opt_default:
 
| DEFAULT;

opt_binary:
 
| ASCII_SYM opt_bin_mod
| BYTE_SYM
| UNICODE_SYM opt_bin_mod
| charset charset_name opt_bin_mod
| BINARY opt_bin_charset;

opt_bin_mod:
 
| BINARY;

opt_bin_charset:
 
| ASCII_SYM
| UNICODE_SYM
| charset charset_name;

opt_primary:
 
| PRIMARY_SYM;

references:
  REFERENCES table_ident opt_ref_list;

opt_ref_list:
  opt_on_delete
| '(' ref_list ')' opt_on_delete;

ref_list:
  ref_list ',' ident
| ident;

opt_on_delete:
 
| opt_on_delete_list;

opt_on_delete_list:
  opt_on_delete_list opt_on_delete_item
| opt_on_delete_item;

opt_on_delete_item:
  ON DELETE_SYM delete_option
| ON UPDATE_SYM delete_option
| MATCH FULL
| MATCH PARTIAL
| MATCH SIMPLE_SYM;

delete_option:
  RESTRICT
| CASCADE
| SET NULL_SYM
| NO_SYM ACTION
| SET DEFAULT;

key_type:
  key_or_index
| FULLTEXT_SYM opt_key_or_index
| SPATIAL_SYM opt_key_or_index;

constraint_key_type:
  PRIMARY_SYM KEY_SYM
| UNIQUE_SYM opt_key_or_index;

key_or_index:
  KEY_SYM
| INDEX_SYM;

opt_key_or_index:
 
| key_or_index;

keys_or_index:
  KEYS
| INDEX_SYM
| INDEXES;

opt_unique_or_fulltext:
 
| UNIQUE_SYM
| FULLTEXT_SYM
| SPATIAL_SYM;

init_key_options:
 ;

key_alg:
  init_key_options
| init_key_options key_using_alg;

key_options:
 
| key_opts;

key_opts:
  key_opt
| key_opts key_opt;

key_using_alg:
  USING btree_or_rtree
| TYPE_SYM btree_or_rtree;

key_opt:
  key_using_alg
| KEY_BLOCK_SIZE opt_equal ulong_num
| WITH PARSER_SYM IDENT_sys;

btree_or_rtree:
  BTREE_SYM
| RTREE_SYM
| HASH_SYM;

key_list:
  key_list ',' key_part order_dir
| key_part order_dir;

key_part:
  ident
| ident '(' NUM ')';

opt_ident:
 
| field_ident;

opt_component:
 
| '.' ident;

string_list:
  text_string
| string_list ',' text_string;

alter:
  ALTER opt_ignore TABLE_SYM table_ident alter_commands
| ALTER DATABASE ident_or_empty opt_create_database_options
| ALTER PROCEDURE sp_name sp_a_chistics
| ALTER FUNCTION_SYM sp_name sp_a_chistics
| ALTER view_algorithm definer view_tail
| ALTER definer view_tail
| ALTER definer EVENT_SYM sp_name ev_alter_on_schedule_completion opt_ev_rename_to opt_ev_status opt_ev_comment opt_ev_sql_stmt
| ALTER TABLESPACE alter_tablespace_info
| ALTER LOGFILE_SYM GROUP_SYM alter_logfile_group_info
| ALTER TABLESPACE change_tablespace_info
| ALTER TABLESPACE change_tablespace_access
| ALTER SERVER_SYM ident_or_text OPTIONS_SYM '(' server_options_list ')';

ev_alter_on_schedule_completion:
 
| ON SCHEDULE_SYM ev_schedule_time
| ev_on_completion
| ON SCHEDULE_SYM ev_schedule_time ev_on_completion;

opt_ev_rename_to:
 
| RENAME TO_SYM sp_name;

opt_ev_sql_stmt:
 
| DO_SYM ev_sql_stmt;

ident_or_empty:
 
| ident;

alter_commands:
 
| DISCARD TABLESPACE
| IMPORT TABLESPACE
| alter_list opt_partitioning
| alter_list remove_partitioning
| remove_partitioning
| partitioning
| add_partition_rule
| DROP PARTITION_SYM alt_part_name_list
| REBUILD_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list
| OPTIMIZE PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_no_write_to_binlog opt_mi_check_type
| ANALYZE_SYM PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_mi_check_type
| CHECK_SYM PARTITION_SYM all_or_alt_part_name_list opt_mi_check_type
| REPAIR PARTITION_SYM opt_no_write_to_binlog all_or_alt_part_name_list opt_mi_repair_type
| COALESCE PARTITION_SYM opt_no_write_to_binlog real_ulong_num
| reorg_partition_rule;

remove_partitioning:
  REMOVE_SYM PARTITIONING_SYM;

all_or_alt_part_name_list:
  ALL
| alt_part_name_list;

add_partition_rule:
  ADD PARTITION_SYM opt_no_write_to_binlog add_part_extra;

add_part_extra:
 
| '(' part_def_list ')'
| PARTITIONS_SYM real_ulong_num;

reorg_partition_rule:
  REORGANIZE_SYM PARTITION_SYM opt_no_write_to_binlog reorg_parts_rule;

reorg_parts_rule:
 
| alt_part_name_list INTO '(' part_def_list ')';

alt_part_name_list:
  alt_part_name_item
| alt_part_name_list ',' alt_part_name_item;

alt_part_name_item:
  ident;

alter_list:
  alter_list_item
| alter_list ',' alter_list_item;

add_column:
  ADD opt_column;

alter_list_item:
  add_column column_def opt_place
| ADD key_def
| add_column '(' field_list ')'
| CHANGE opt_column field_ident field_spec opt_place
| MODIFY_SYM opt_column field_ident type opt_attribute opt_place
| DROP opt_column field_ident opt_restrict
| DROP FOREIGN KEY_SYM opt_ident
| DROP PRIMARY_SYM KEY_SYM
| DROP key_or_index field_ident
| DISABLE_SYM KEYS
| ENABLE_SYM KEYS
| ALTER opt_column field_ident SET DEFAULT signed_literal
| ALTER opt_column field_ident DROP DEFAULT
| RENAME opt_to table_ident
| CONVERT_SYM TO_SYM charset charset_name_or_default opt_collate
| create_table_options_space_separated
| FORCE_SYM
| alter_order_clause;

opt_column:
 
| COLUMN_SYM;

opt_ignore:
 
| IGNORE_SYM;

opt_restrict:
 
| RESTRICT
| CASCADE;

opt_place:
 
| AFTER_SYM ident
| FIRST_SYM;

opt_to:
 
| TO_SYM
| EQ
| AS;

slave:
  START_SYM SLAVE slave_thread_opts slave_until
| STOP_SYM SLAVE slave_thread_opts
| SLAVE START_SYM slave_thread_opts slave_until
| SLAVE STOP_SYM slave_thread_opts;

start:
  START_SYM TRANSACTION_SYM start_transaction_opts;

start_transaction_opts:
 
| WITH CONSISTENT_SYM SNAPSHOT_SYM;

slave_thread_opts:
  slave_thread_opt_list;

slave_thread_opt_list:
  slave_thread_opt
| slave_thread_opt_list ',' slave_thread_opt;

slave_thread_opt:
 
| SQL_THREAD
| RELAY_THREAD;

slave_until:
 
| UNTIL_SYM slave_until_opts;

slave_until_opts:
  master_file_def
| slave_until_opts ',' master_file_def;

restore:
  RESTORE_SYM table_or_tables table_list FROM TEXT_STRING_sys;

backup:
  BACKUP_SYM table_or_tables table_list TO_SYM TEXT_STRING_sys;

checksum:
  CHECKSUM_SYM table_or_tables table_list opt_checksum_type;

opt_checksum_type:
 
| QUICK
| EXTENDED_SYM;

repair:
  REPAIR opt_no_write_to_binlog table_or_tables table_list opt_mi_repair_type;

opt_mi_repair_type:
 
| mi_repair_types;

mi_repair_types:
  mi_repair_type
| mi_repair_type mi_repair_types;

mi_repair_type:
  QUICK
| EXTENDED_SYM
| USE_FRM;

analyze:
  ANALYZE_SYM opt_no_write_to_binlog table_or_tables table_list opt_mi_check_type;

binlog_base64_event:
  BINLOG_SYM TEXT_STRING_sys;

check:
  CHECK_SYM table_or_tables table_list opt_mi_check_type;

opt_mi_check_type:
 
| mi_check_types;

mi_check_types:
  mi_check_type
| mi_check_type mi_check_types;

mi_check_type:
  QUICK
| FAST_SYM
| MEDIUM_SYM
| EXTENDED_SYM
| CHANGED
| FOR_SYM UPGRADE_SYM;

optimize:
  OPTIMIZE opt_no_write_to_binlog table_or_tables table_list opt_mi_check_type;

opt_no_write_to_binlog:
 
| NO_WRITE_TO_BINLOG
| LOCAL_SYM;

rename:
  RENAME table_or_tables table_to_table_list
| RENAME DATABASE db_to_db
| RENAME USER clear_privileges rename_list;

rename_list:
  user TO_SYM user
| rename_list ',' user TO_SYM user;

table_to_table_list:
  table_to_table
| table_to_table_list ',' table_to_table;

table_to_table:
  table_ident TO_SYM table_ident;

db_to_db:
  ident TO_SYM ident;

keycache:
  CACHE_SYM INDEX_SYM keycache_list IN_SYM key_cache_name;

keycache_list:
  assign_to_keycache
| keycache_list ',' assign_to_keycache;

assign_to_keycache:
  table_ident cache_keys_spec;

key_cache_name:
  ident
| DEFAULT;

preload:
  LOAD INDEX_SYM INTO CACHE_SYM preload_list;

preload_list:
  preload_keys
| preload_list ',' preload_keys;

preload_keys:
  table_ident cache_keys_spec opt_ignore_leaves;

cache_keys_spec:
  cache_key_list_or_empty;

cache_key_list_or_empty:
 
| key_or_index '(' opt_key_usage_list ')';

opt_ignore_leaves:
 
| IGNORE_SYM LEAVES;

select:
  select_init;

select_init:
  SELECT_SYM select_init2
| '(' select_paren ')' union_opt;

select_paren:
  SELECT_SYM select_part2
| '(' select_paren ')';select_init2:
  select_part2 union_clause;

select_part2:
  select_options select_item_list select_into select_lock_type;

select_into:
  opt_order_clause opt_limit_clause
| into
| select_from
| into select_from
| select_from into;

select_from:
  FROM join_table_list where_clause group_clause having_clause opt_order_clause opt_limit_clause procedure_clause
| FROM DUAL_SYM where_clause opt_limit_clause;

select_options:
 
| select_option_list;

select_option_list:
  select_option_list select_option
| select_option;

select_option:
  STRAIGHT_JOIN
| HIGH_PRIORITY
| DISTINCT
| SQL_SMALL_RESULT
| SQL_BIG_RESULT
| SQL_BUFFER_RESULT
| SQL_CALC_FOUND_ROWS
| SQL_NO_CACHE_SYM
| SQL_CACHE_SYM
| ALL;

select_lock_type:
 
| FOR_SYM UPDATE_SYM
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM;

select_item_list:
  select_item_list ',' select_item
| select_item
| '*';

select_item:
  remember_name select_item2 remember_end select_alias;

remember_name:
 ;

remember_end:
 ;

select_item2:
  table_wild
| expr;

select_alias:
 
| AS ident
| AS TEXT_STRING_sys
| ident
| TEXT_STRING_sys;

optional_braces:
 
| '(' ')';

expr:
  bool_term bool_or_expr;

bool_or_expr:
 
| bool_or_expr or bool_term;

bool_term:
  bool_term XOR bool_term
| bool_factor bool_and_expr;

bool_and_expr:
 
| bool_and_expr and bool_factor;

bool_factor:
  NOT_SYM bool_factor
| bool_test;

bool_test:
  bool_pri IS TRUE_SYM
| bool_pri IS not TRUE_SYM
| bool_pri IS FALSE_SYM
| bool_pri IS not FALSE_SYM
| bool_pri IS UNKNOWN_SYM
| bool_pri IS not UNKNOWN_SYM
| bool_pri;

bool_pri:
  bool_pri IS NULL_SYM
| bool_pri IS not NULL_SYM
| bool_pri EQUAL_SYM predicate
| bool_pri comp_op predicate %prec EQ
| bool_pri comp_op all_or_any '(' subselect ')' %prec EQ
| predicate;

predicate:
  bit_expr IN_SYM '(' subselect ')'
| bit_expr not IN_SYM '(' subselect ')'
| bit_expr IN_SYM '(' expr ')'
| bit_expr IN_SYM '(' expr ',' expr_list ')'
| bit_expr not IN_SYM '(' expr ')'
| bit_expr not IN_SYM '(' expr ',' expr_list ')'
| bit_expr BETWEEN_SYM bit_expr AND_SYM predicate
| bit_expr not BETWEEN_SYM bit_expr AND_SYM predicate
| bit_expr SOUNDS_SYM LIKE bit_expr
| bit_expr LIKE simple_expr opt_escape
| bit_expr not LIKE simple_expr opt_escape
| bit_expr REGEXP bit_expr
| bit_expr not REGEXP bit_expr
| bit_expr;

bit_expr:
  bit_expr '|' bit_term
| bit_term;

bit_term:
  bit_term '&' bit_factor
| bit_factor;

bit_factor:
  bit_factor SHIFT_LEFT value_expr
| bit_factor SHIFT_RIGHT value_expr
| value_expr;

value_expr:
  value_expr '+' term
| value_expr '-' term
| value_expr '+' interval_expr interval
| value_expr '-' interval_expr interval
| term;

term:
  term '*' factor
| term '/' factor
| term '%' factor
| term DIV_SYM factor
| term MOD_SYM factor
| factor;

factor:
  factor '^' simple_expr
| simple_expr;

or:
  OR_SYM
| OR2_SYM;

and:
  AND_SYM
| AND_AND_SYM;

not:
  NOT_SYM
| NOT2_SYM;

not2:
  '!'
| NOT2_SYM;

comp_op:
  EQ
| GE
| GT_SYM
| LE
| LT
| NE;

all_or_any:
  ALL
| ANY_SYM;

interval_expr:
  INTERVAL_SYM expr;

simple_expr:
  simple_ident
| function_call_keyword
| function_call_nonkeyword
| function_call_generic
| function_call_conflict
| simple_expr COLLATE_SYM ident_or_text %prec NEG
| literal
| param_marker
| variable
| sum_expr
| simple_expr OR_OR_SYM simple_expr
| '+' simple_expr %prec NEG
| '-' simple_expr %prec NEG
| '~' simple_expr %prec NEG
| not2 simple_expr %prec NEG
| '(' subselect ')'
| '(' expr ')'
| '(' expr ',' expr_list ')'
| ROW_SYM '(' expr ',' expr_list ')'
| EXISTS '(' subselect ')'
| '{' ident expr '}'
| MATCH ident_list_arg AGAINST '(' bit_expr fulltext_options ')'
| BINARY simple_expr %prec NEG
| CAST_SYM '(' expr AS cast_type ')'
| CASE_SYM opt_expr when_list opt_else END
| CONVERT_SYM '(' expr ',' cast_type ')'
| CONVERT_SYM '(' expr USING charset_name ')'
| DEFAULT '(' simple_ident ')'
| VALUES '(' simple_ident_nospvar ')'
| interval_expr interval '+' expr
| interval_expr;

function_call_keyword:
  CHAR_SYM '(' expr_list ')'
| CHAR_SYM '(' expr_list USING charset_name ')'
| CURRENT_USER optional_braces
| DATE_SYM '(' expr ')'
| DAY_SYM '(' expr ')'
| HOUR_SYM '(' expr ')'
| INSERT '(' expr ',' expr ',' expr ',' expr ')'
| LEFT '(' expr ',' expr ')'
| MINUTE_SYM '(' expr ')'
| MONTH_SYM '(' expr ')'
| RIGHT '(' expr ',' expr ')'
| SECOND_SYM '(' expr ')'
| TIME_SYM '(' expr ')'
| TIMESTAMP '(' expr ')'
| TIMESTAMP '(' expr ',' expr ')'
| TRIM '(' expr ')'
| TRIM '(' LEADING expr FROM expr ')'
| TRIM '(' TRAILING expr FROM expr ')'
| TRIM '(' BOTH expr FROM expr ')'
| TRIM '(' LEADING FROM expr ')'
| TRIM '(' TRAILING FROM expr ')'
| TRIM '(' BOTH FROM expr ')'
| TRIM '(' expr FROM expr ')'
| USER '(' ')'
| YEAR_SYM '(' expr ')';

function_call_nonkeyword:
  ADDDATE_SYM '(' expr ',' expr ')'
| ADDDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
| CURDATE optional_braces
| CURTIME optional_braces
| CURTIME '(' expr ')'
| DATE_ADD_INTERVAL '(' expr ',' interval_expr interval ')'
| DATE_SUB_INTERVAL '(' expr ',' interval_expr interval ')'
| EXTRACT_SYM '(' interval FROM expr ')'
| GET_FORMAT '(' date_time_type ',' expr ')'
| NOW_SYM optional_braces
| NOW_SYM '(' expr ')'
| POSITION_SYM '(' bit_expr IN_SYM expr ')'
| SUBDATE_SYM '(' expr ',' expr ')'
| SUBDATE_SYM '(' expr ',' INTERVAL_SYM expr interval ')'
| SUBSTRING '(' expr ',' expr ',' expr ')'
| SUBSTRING '(' expr ',' expr ')'
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
| SUBSTRING '(' expr FROM expr ')'
| SYSDATE optional_braces
| SYSDATE '(' expr ')'
| TIMESTAMP_ADD '(' interval_time_st ',' expr ',' expr ')'
| TIMESTAMP_DIFF '(' interval_time_st ',' expr ',' expr ')'
| UTC_DATE_SYM optional_braces
| UTC_TIME_SYM optional_braces
| UTC_TIMESTAMP_SYM optional_braces;

function_call_conflict:
  ASCII_SYM '(' expr ')'
| CHARSET '(' expr ')'
| COALESCE '(' expr_list ')'
| COLLATION_SYM '(' expr ')'
| DATABASE '(' ')'
| IF '(' expr ',' expr ',' expr ')'
| MICROSECOND_SYM '(' expr ')'
| MOD_SYM '(' expr ',' expr ')'
| OLD_PASSWORD '(' expr ')'
| PASSWORD '(' expr ')'
| QUARTER_SYM '(' expr ')'
| REPEAT_SYM '(' expr ',' expr ')'
| REPLACE '(' expr ',' expr ',' expr ')'
| TRUNCATE_SYM '(' expr ',' expr ')'
| WEEK_SYM '(' expr ')'
| WEEK_SYM '(' expr ',' expr ')'
| geometry_function;

geometry_function:
  CONTAINS_SYM '(' expr ',' expr ')'
| GEOMETRYCOLLECTION '(' expr_list ')'
| LINESTRING '(' expr_list ')'
| MULTILINESTRING '(' expr_list ')'
| MULTIPOINT '(' expr_list ')'
| MULTIPOLYGON '(' expr_list ')'
| POINT_SYM '(' expr ',' expr ')'
| POLYGON '(' expr_list ')';

function_call_generic:
  IDENT_sys '(' udf_expr_list ')'
| ident '.' ident '(' opt_expr_list ')';

fulltext_options:
  opt_natural_language_mode opt_query_expansion
| IN_SYM BOOLEAN_SYM MODE_SYM;

opt_natural_language_mode:
 
| IN_SYM NATURAL LANGUAGE_SYM MODE_SYM;

opt_query_expansion:
 
| WITH QUERY_SYM EXPANSION_SYM;

udf_expr_list:
 
| udf_expr_list2;

udf_expr_list2:
  udf_expr_list3;

udf_expr_list3:
  udf_expr
| udf_expr_list3 ',' udf_expr;

udf_expr:
  remember_name expr remember_end select_alias;

sum_expr:
  AVG_SYM '(' in_sum_expr ')'
| AVG_SYM '(' DISTINCT in_sum_expr ')'
| BIT_AND '(' in_sum_expr ')'
| BIT_OR '(' in_sum_expr ')'
| BIT_XOR '(' in_sum_expr ')'
| COUNT_SYM '(' opt_all '*' ')'
| COUNT_SYM '(' in_sum_expr ')'
| COUNT_SYM '(' DISTINCT expr_list ')'
| MIN_SYM '(' in_sum_expr ')'
| MIN_SYM '(' DISTINCT in_sum_expr ')'
| MAX_SYM '(' in_sum_expr ')'
| MAX_SYM '(' DISTINCT in_sum_expr ')'
| STD_SYM '(' in_sum_expr ')'
| VARIANCE_SYM '(' in_sum_expr ')'
| STDDEV_SAMP_SYM '(' in_sum_expr ')'
| VAR_SAMP_SYM '(' in_sum_expr ')'
| SUM_SYM '(' in_sum_expr ')'
| SUM_SYM '(' DISTINCT in_sum_expr ')'
| GROUP_CONCAT_SYM '(' opt_distinct expr_list opt_gorder_clause opt_gconcat_separator ')';

variable:
  '@' variable_aux;

variable_aux:
  ident_or_text SET_VAR expr
| ident_or_text
| '@' opt_var_ident_type ident_or_text opt_component;

opt_distinct:
 
|DISTINCT;

opt_gconcat_separator:
 
|SEPARATOR_SYM text_string;

opt_gorder_clause:
 
| order_clause;

in_sum_expr:
  opt_all expr;

cast_type:
  BINARY opt_len
| CHAR_SYM opt_len opt_binary
| NCHAR_SYM opt_len
| SIGNED_SYM
| SIGNED_SYM INT_SYM
| UNSIGNED
| UNSIGNED INT_SYM
| DATE_SYM
| TIME_SYM
| DATETIME
| DECIMAL_SYM float_options;

opt_expr_list:
 
| expr_list;

expr_list:
  expr_list2;

expr_list2:
  expr
| expr_list2 ',' expr;

ident_list_arg:
  ident_list
| '(' ident_list ')';

ident_list:
  ident_list2;

ident_list2:
  simple_ident
| ident_list2 ',' simple_ident;

opt_expr:
 
| expr;

opt_else:
 
| ELSE expr;

when_list:
  WHEN_SYM expr THEN_SYM expr
| when_list WHEN_SYM expr THEN_SYM expr;

table_ref:
  table_factor
| join_table;

join_table_list:
  derived_table_list;

derived_table_list:
  table_ref
| derived_table_list ',' table_ref;

join_table:
  table_ref %prec TABLE_REF_PRIORITY normal_join table_ref
| table_ref STRAIGHT_JOIN table_factor
| table_ref normal_join table_ref ON expr
| table_ref STRAIGHT_JOIN table_factor ON expr
| table_ref normal_join table_ref USING '(' using_list ')'
| table_ref NATURAL JOIN_SYM table_factor
| table_ref LEFT opt_outer JOIN_SYM table_ref ON expr
| table_ref LEFT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
| table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
| table_ref RIGHT opt_outer JOIN_SYM table_ref ON expr
| table_ref RIGHT opt_outer JOIN_SYM table_factor USING '(' using_list ')'
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor;

normal_join:
  JOIN_SYM
| INNER_SYM JOIN_SYM
| CROSS JOIN_SYM;

table_factor:
  table_ident opt_table_alias opt_key_definition
| '{' ident table_ref LEFT OUTER JOIN_SYM table_ref ON expr '}'
| select_derived_init get_select_lex select_derived2
| '(' get_select_lex select_derived union_opt ')' opt_table_alias;

select_derived:
  get_select_lex derived_table_list;

select_derived2:
  select_options select_item_list opt_select_from;

get_select_lex:
 ;

select_derived_init:
  SELECT_SYM;

opt_outer:
 
| OUTER;

index_hint_clause:
 
| FOR_SYM JOIN_SYM
| FOR_SYM ORDER_SYM BY
| FOR_SYM GROUP_SYM BY;

index_hint_type:
  FORCE_SYM
| IGNORE_SYM;

index_hint_definition:
  index_hint_type key_or_index index_hint_clause '(' key_usage_list ')'
| USE_SYM key_or_index index_hint_clause '(' opt_key_usage_list ')';

index_hints_list:
  index_hint_definition
| index_hints_list index_hint_definition;

opt_index_hints_list:
 
| index_hints_list;

opt_key_definition:
  opt_index_hints_list;

opt_key_usage_list:
 
| key_usage_list;

key_usage_element:
  ident
| PRIMARY_SYM;

key_usage_list:
  key_usage_element
| key_usage_list ',' key_usage_element;

using_list:
  ident
| using_list ',' ident;

interval:
  interval_time_st
| DAY_HOUR_SYM
| DAY_MICROSECOND_SYM
| DAY_MINUTE_SYM
| DAY_SECOND_SYM
| HOUR_MICROSECOND_SYM
| HOUR_MINUTE_SYM
| HOUR_SECOND_SYM
| MICROSECOND_SYM
| MINUTE_MICROSECOND_SYM
| MINUTE_SECOND_SYM
| SECOND_MICROSECOND_SYM
| YEAR_MONTH_SYM;

interval_time_st:
  DAY_SYM
| WEEK_SYM
| HOUR_SYM
| FRAC_SECOND_SYM
| MINUTE_SYM
| MONTH_SYM
| QUARTER_SYM
| SECOND_SYM
| YEAR_SYM;

date_time_type:
  DATE_SYM
| TIME_SYM
| DATETIME
| TIMESTAMP;

table_alias:
 
| AS
| EQ;

opt_table_alias:
 
| table_alias ident;

opt_all:
 
| ALL;

where_clause:
 
| WHERE expr;

having_clause:
 
| HAVING expr;

opt_escape:
  ESCAPE_SYM simple_expr
|;

group_clause:
 
| GROUP_SYM BY group_list olap_opt;

group_list:
  group_list ',' order_ident order_dir
| order_ident order_dir;

olap_opt:
 
| WITH CUBE_SYM
| WITH ROLLUP_SYM;

alter_order_clause:
  ORDER_SYM BY alter_order_list;

alter_order_list:
  alter_order_list ',' alter_order_item
| alter_order_item;

alter_order_item:
  simple_ident_nospvar order_dir;

opt_order_clause:
 
| order_clause;

order_clause:
  ORDER_SYM BY order_list;

order_list:
  order_list ',' order_ident order_dir
| order_ident order_dir;

order_dir:
 
| ASC
| DESC;

opt_limit_clause_init:
 
| limit_clause;

opt_limit_clause:
 
| limit_clause;

limit_clause:
  LIMIT limit_options;

limit_options:
  limit_option
| limit_option ',' limit_option
| limit_option OFFSET_SYM limit_option;

limit_option:
  param_marker
| ULONGLONG_NUM
| LONG_NUM
| NUM;

delete_limit_clause:
 
| LIMIT limit_option;

ulong_num:
  NUM
| HEX_NUM
| LONG_NUM
| ULONGLONG_NUM
| DECIMAL_NUM
| FLOAT_NUM;

real_ulong_num:
  NUM
| HEX_NUM
| LONG_NUM
| ULONGLONG_NUM
| dec_num_error;

ulonglong_num:
  NUM
| ULONGLONG_NUM
| LONG_NUM
| DECIMAL_NUM
| FLOAT_NUM;

real_ulonglong_num:
  NUM
| ULONGLONG_NUM
| LONG_NUM
| dec_num_error;

dec_num_error:
  dec_num;

dec_num:
  DECIMAL_NUM
| FLOAT_NUM;

procedure_clause:
 
| PROCEDURE ident '(' procedure_list ')';procedure_list:
 
| procedure_list2;

procedure_list2:
  procedure_list2 ',' procedure_item
| procedure_item;

procedure_item:
  remember_name expr;

select_var_list_init:
  select_var_list;

select_var_list:
  select_var_list ',' select_var_ident
| select_var_ident;

select_var_ident:
  '@' ident_or_text
| ident_or_text;

into:
  INTO into_destination;

into_destination:
  OUTFILE TEXT_STRING_filesystem opt_field_term opt_line_term
| DUMPFILE TEXT_STRING_filesystem
| select_var_list_init;

do:
  DO_SYM expr_list;

drop:
  DROP opt_temporary table_or_tables if_exists table_list opt_restrict
| DROP INDEX_SYM ident ON table_ident
| DROP DATABASE if_exists ident
| DROP FUNCTION_SYM if_exists sp_name
| DROP PROCEDURE if_exists sp_name
| DROP USER clear_privileges user_list
| DROP VIEW_SYM if_exists table_list opt_restrict
| DROP EVENT_SYM if_exists sp_name
| DROP TRIGGER_SYM if_exists sp_name
| DROP TABLESPACE tablespace_name opt_ts_engine opt_ts_wait
| DROP LOGFILE_SYM GROUP_SYM logfile_group_name opt_ts_engine opt_ts_wait
| DROP SERVER_SYM if_exists ident_or_text;

table_list:
  table_name
| table_list ',' table_name;

table_name:
  table_ident;

if_exists:
 
| IF EXISTS;

opt_temporary:
 
| TEMPORARY;

insert:
  INSERT insert_lock_option opt_ignore insert2 insert_field_spec opt_insert_update;

replace:
  REPLACE replace_lock_option insert2 insert_field_spec;

insert_lock_option:
 
| LOW_PRIORITY
| DELAYED_SYM
| HIGH_PRIORITY;

replace_lock_option:
  opt_low_priority
| DELAYED_SYM;

insert2:
  INTO insert_table
| insert_table;

insert_table:
  table_name;

insert_field_spec:
  insert_values
| '(' ')' insert_values
| '(' fields ')' insert_values
| SET ident_eq_list;

fields:
  fields ',' insert_ident
| insert_ident;

insert_values:
  VALUES values_list
| VALUE_SYM values_list
| create_select union_clause
| '(' create_select ')' union_opt;

values_list:
  values_list ',' no_braces
| no_braces;

ident_eq_list:
  ident_eq_list ',' ident_eq_value
| ident_eq_value;

ident_eq_value:
  simple_ident_nospvar equal expr_or_default;

equal:
  EQ
| SET_VAR;

opt_equal:
 
| equal;

no_braces:
  '(' opt_values ')';

opt_values:
 
| values;

values:
  values ',' expr_or_default
| expr_or_default;

expr_or_default:
  expr
| DEFAULT;

opt_insert_update:
 
| ON DUPLICATE_SYM KEY_SYM UPDATE_SYM insert_update_list;

update:
  UPDATE_SYM opt_low_priority opt_ignore join_table_list SET update_list where_clause opt_order_clause delete_limit_clause;

update_list:
  update_list ',' update_elem
| update_elem;

update_elem:
  simple_ident_nospvar equal expr_or_default;

insert_update_list:
  insert_update_list ',' insert_update_elem
| insert_update_elem;

insert_update_elem:
  simple_ident_nospvar equal expr_or_default;

opt_low_priority:
 
| LOW_PRIORITY;

delete:
  DELETE_SYM opt_delete_options single_multi;

single_multi:
  FROM table_ident where_clause opt_order_clause delete_limit_clause
| table_wild_list FROM join_table_list where_clause
| FROM table_wild_list USING join_table_list where_clause;

table_wild_list:
  table_wild_one
| table_wild_list ',' table_wild_one;

table_wild_one:
  ident opt_wild opt_table_alias
| ident '.' ident opt_wild opt_table_alias;

opt_wild:
 
| '.' '*';

opt_delete_options:
 
| opt_delete_option opt_delete_options;

opt_delete_option:
  QUICK
| LOW_PRIORITY
| IGNORE_SYM;

truncate:
  TRUNCATE_SYM opt_table_sym table_name;

opt_table_sym:
 
| TABLE_SYM;

show:
  SHOW show_param;

show_param:
  DATABASES wild_and_where
| opt_full TABLES opt_db wild_and_where
| opt_full TRIGGERS_SYM opt_db wild_and_where
| EVENTS_SYM opt_db wild_and_where
| TABLE_SYM STATUS_SYM opt_db wild_and_where
| OPEN_SYM TABLES opt_db wild_and_where
| opt_full PLUGIN_SYM
| PLUGINS_SYM
| ENGINE_SYM known_storage_engines show_engine_param
| ENGINE_SYM ALL show_engine_param
| opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
| NEW_SYM MASTER_SYM FOR_SYM SLAVE WITH MASTER_LOG_FILE_SYM EQ TEXT_STRING_sys AND_SYM MASTER_LOG_POS_SYM EQ ulonglong_num AND_SYM MASTER_SERVER_ID_SYM EQ ulong_num
| master_or_binary LOGS_SYM
| SLAVE HOSTS_SYM
| BINLOG_SYM EVENTS_SYM binlog_in binlog_from opt_limit_clause_init
| keys_or_index from_or_in table_ident opt_db where_clause
| COLUMN_SYM TYPES_SYM
| TABLE_SYM TYPES_SYM
| opt_storage ENGINES_SYM
| AUTHORS_SYM
| CONTRIBUTORS_SYM
| PRIVILEGES
| COUNT_SYM '(' '*' ')' WARNINGS
| COUNT_SYM '(' '*' ')' ERRORS
| WARNINGS opt_limit_clause_init
| ERRORS opt_limit_clause_init
| opt_var_type STATUS_SYM wild_and_where
| INNOBASE_SYM STATUS_SYM
| MUTEX_SYM STATUS_SYM
| opt_full PROCESSLIST_SYM
| opt_var_type VARIABLES wild_and_where
| charset wild_and_where
| COLLATION_SYM wild_and_where
| GRANTS
| GRANTS FOR_SYM user
| CREATE DATABASE opt_if_not_exists ident
| CREATE TABLE_SYM table_ident
| CREATE VIEW_SYM table_ident
| MASTER_SYM STATUS_SYM
| SLAVE STATUS_SYM
| CREATE PROCEDURE sp_name
| CREATE FUNCTION_SYM sp_name
| PROCEDURE STATUS_SYM wild_and_where
| FUNCTION_SYM STATUS_SYM wild_and_where
| PROCEDURE CODE_SYM sp_name
| FUNCTION_SYM CODE_SYM sp_name
| CREATE EVENT_SYM sp_name;

show_engine_param:
  STATUS_SYM
| MUTEX_SYM
| LOGS_SYM;

master_or_binary:
  MASTER_SYM
| BINARY;

opt_storage:
 
| STORAGE_SYM;

opt_db:
 
| from_or_in ident;

opt_full:
 
| FULL;

from_or_in:
  FROM
| IN_SYM;

binlog_in:
 
| IN_SYM TEXT_STRING_sys;

binlog_from:
 
| FROM ulonglong_num;

wild_and_where:
 
| LIKE TEXT_STRING_sys
| WHERE expr;

describe:
  describe_command table_ident opt_describe_column
| describe_command opt_extended_describe select;

describe_command:
  DESC
| DESCRIBE;

opt_extended_describe:
 
| EXTENDED_SYM
| PARTITIONS_SYM;

opt_describe_column:
 
| text_string
| ident;

flush:
  FLUSH_SYM opt_no_write_to_binlog flush_options;

flush_options:
  flush_options ',' flush_option
| flush_option;

flush_option:
  table_or_tables opt_table_list
| TABLES WITH READ_SYM LOCK_SYM
| QUERY_SYM CACHE_SYM
| HOSTS_SYM
| PRIVILEGES
| LOGS_SYM
| STATUS_SYM
| SLAVE
| MASTER_SYM
| DES_KEY_FILE
| RESOURCES;

opt_table_list:
 
| table_list;

reset:
  RESET_SYM reset_options;

reset_options:
  reset_options ',' reset_option
| reset_option;

reset_option:
  SLAVE
| MASTER_SYM
| QUERY_SYM CACHE_SYM;

purge:
  PURGE purge_options;

purge_options:
  master_or_binary LOGS_SYM purge_option;

purge_option:
  TO_SYM TEXT_STRING_sys
| BEFORE_SYM expr;

kill:
  KILL_SYM kill_option expr;

kill_option:
 
| CONNECTION_SYM
| QUERY_SYM;

use:
  USE_SYM ident;

load:
  LOAD DATA_SYM load_data
| LOAD TABLE_SYM table_ident FROM MASTER_SYM;

load_data:
  load_data_lock opt_local INFILE TEXT_STRING_filesystem opt_duplicate INTO TABLE_SYM table_ident opt_load_data_charset opt_field_term opt_line_term opt_ignore_lines opt_field_or_var_spec opt_load_data_set_spec
| FROM MASTER_SYM;

opt_local:
 
| LOCAL_SYM;

load_data_lock:
 
| CONCURRENT
| LOW_PRIORITY;

opt_duplicate:
 
| REPLACE
| IGNORE_SYM;

opt_field_term:
 
| COLUMNS field_term_list;

field_term_list:
  field_term_list field_term
| field_term;

field_term:
  TERMINATED BY text_string
| OPTIONALLY ENCLOSED BY text_string
| ENCLOSED BY text_string
| ESCAPED BY text_string;

opt_line_term:
 
| LINES line_term_list;

line_term_list:
  line_term_list line_term
| line_term;

line_term:
  TERMINATED BY text_string
| STARTING BY text_string;

opt_ignore_lines:
 
| IGNORE_SYM NUM LINES;

opt_field_or_var_spec:
 
| '(' fields_or_vars ')'
| '(' ')';

fields_or_vars:
  fields_or_vars ',' field_or_var
| field_or_var;

field_or_var:
  simple_ident_nospvar
| '@' ident_or_text;

opt_load_data_set_spec:
 
| SET insert_update_list;

text_literal:
  TEXT_STRING_literal
| NCHAR_STRING
| UNDERSCORE_CHARSET TEXT_STRING
| text_literal TEXT_STRING_literal;

text_string:
  TEXT_STRING_literal
| HEX_NUM
| BIN_NUM;

param_marker:
  PARAM_MARKER;

signed_literal:
  literal
| '+' NUM_literal
| '-' NUM_literal;

literal:
  text_literal
| NUM_literal
| NULL_SYM
| FALSE_SYM
| TRUE_SYM
| HEX_NUM
| BIN_NUM
| UNDERSCORE_CHARSET HEX_NUM
| UNDERSCORE_CHARSET BIN_NUM
| DATE_SYM text_literal
| TIME_SYM text_literal
| TIMESTAMP text_literal;

NUM_literal:
  NUM
| LONG_NUM
| ULONGLONG_NUM
| DECIMAL_NUM
| FLOAT_NUM;

insert_ident:
  simple_ident_nospvar
| table_wild;

table_wild:
  ident '.' '*'
| ident '.' ident '.' '*';

order_ident:
  expr;

simple_ident:
  ident
| simple_ident_q;

simple_ident_nospvar:
  ident
| simple_ident_q;

simple_ident_q:
  ident '.' ident
| '.' ident '.' ident
| ident '.' ident '.' ident;

field_ident:
  ident
| ident '.' ident '.' ident
| ident '.' ident
| '.' ident;

table_ident:
  ident
| ident '.' ident
| '.' ident;

table_ident_nodb:
  ident;

IDENT_sys:
  IDENT
| IDENT_QUOTED;

TEXT_STRING_sys:
  TEXT_STRING;

TEXT_STRING_literal:
  TEXT_STRING;

TEXT_STRING_filesystem:
  TEXT_STRING;

ident:
  IDENT_sys
| READ_ONLY_SYM
| keyword;

label_ident:
  IDENT_sys
| keyword_sp;

ident_or_text:
  ident
| TEXT_STRING_sys
| LEX_HOSTNAME;

user:
  ident_or_text
| ident_or_text '@' ident_or_text
| CURRENT_USER optional_braces;

keyword:
  keyword_sp
| ASCII_SYM
| BACKUP_SYM
| BEGIN_SYM
| BYTE_SYM
| CACHE_SYM
| CHARSET
| CHECKSUM_SYM
| CLOSE_SYM
| COMMENT_SYM
| COMMIT_SYM
| CONTAINS_SYM
| DEALLOCATE_SYM
| DO_SYM
| END
| EXECUTE_SYM
| FLUSH_SYM
| HANDLER_SYM
| HELP_SYM
| HOST_SYM
| INSTALL_SYM
| LANGUAGE_SYM
| NO_SYM
| OPEN_SYM
| OPTIONS_SYM
| OWNER_SYM
| PARSER_SYM
| PARTITION_SYM
| PORT_SYM
| PREPARE_SYM
| REMOVE_SYM
| REPAIR
| RESET_SYM
| RESTORE_SYM
| ROLLBACK_SYM
| SAVEPOINT_SYM
| SECURITY_SYM
| SERVER_SYM
| SIGNED_SYM
| SOCKET_SYM
| SLAVE
| SONAME_SYM
| START_SYM
| STOP_SYM
| TRUNCATE_SYM
| UNICODE_SYM
| UNINSTALL_SYM
| WRAPPER_SYM
| XA_SYM
| UPGRADE_SYM;

keyword_sp:
  ACTION
| ADDDATE_SYM
| AFTER_SYM
| AGAINST
| AGGREGATE_SYM
| ALGORITHM_SYM
| ANY_SYM
| AT_SYM
| AUTHORS_SYM
| AUTO_INC
| AUTOEXTEND_SIZE_SYM
| AVG_ROW_LENGTH
| AVG_SYM
| BINLOG_SYM
| BIT_SYM
| BOOL_SYM
| BOOLEAN_SYM
| BTREE_SYM
| CASCADED
| CHAIN_SYM
| CHANGED
| CIPHER_SYM
| CLIENT_SYM
| COALESCE
| CODE_SYM
| COLLATION_SYM
| COLUMNS
| COMMITTED_SYM
| COMPACT_SYM
| COMPLETION_SYM
| COMPRESSED_SYM
| CONCURRENT
| CONNECTION_SYM
| CONSISTENT_SYM
| CONTRIBUTORS_SYM
| CUBE_SYM
| DATA_SYM
| DATAFILE_SYM
| DATETIME
| DATE_SYM
| DAY_SYM
| DEFINER_SYM
| DELAY_KEY_WRITE_SYM
| DES_KEY_FILE
| DIRECTORY_SYM
| DISABLE_SYM
| DISCARD
| DISK_SYM
| DUMPFILE
| DUPLICATE_SYM
| DYNAMIC_SYM
| ENDS_SYM
| ENUM
| ENGINE_SYM
| ENGINES_SYM
| ERRORS
| ESCAPE_SYM
| EVENT_SYM
| EVENTS_SYM
| EVERY_SYM
| EXPANSION_SYM
| EXTENDED_SYM
| EXTENT_SIZE_SYM
| FAST_SYM
| FOUND_SYM
| ENABLE_SYM
| FULL
| FILE_SYM
| FIRST_SYM
| FIXED_SYM
| FRAC_SECOND_SYM
| GEOMETRY_SYM
| GEOMETRYCOLLECTION
| GET_FORMAT
| GRANTS
| GLOBAL_SYM
| HASH_SYM
| HOSTS_SYM
| HOUR_SYM
| IDENTIFIED_SYM
| INVOKER_SYM
| IMPORT
| INDEXES
| INITIAL_SIZE_SYM
| ISOLATION
| ISSUER_SYM
| INNOBASE_SYM
| INSERT_METHOD
| KEY_BLOCK_SIZE
| LAST_SYM
| LEAVES
| LESS_SYM
| LEVEL_SYM
| LINESTRING
| LIST_SYM
| LOCAL_SYM
| LOCKS_SYM
| LOGFILE_SYM
| LOGS_SYM
| MAX_ROWS
| MASTER_SYM
| MASTER_HOST_SYM
| MASTER_PORT_SYM
| MASTER_LOG_FILE_SYM
| MASTER_LOG_POS_SYM
| MASTER_USER_SYM
| MASTER_PASSWORD_SYM
| MASTER_SERVER_ID_SYM
| MASTER_CONNECT_RETRY_SYM
| MASTER_SSL_SYM
| MASTER_SSL_CA_SYM
| MASTER_SSL_CAPATH_SYM
| MASTER_SSL_CERT_SYM
| MASTER_SSL_CIPHER_SYM
| MASTER_SSL_KEY_SYM
| MAX_CONNECTIONS_PER_HOUR
| MAX_QUERIES_PER_HOUR
| MAX_SIZE_SYM
| MAX_UPDATES_PER_HOUR
| MAX_USER_CONNECTIONS_SYM
| MAX_VALUE_SYM
| MEDIUM_SYM
| MEMORY_SYM
| MERGE_SYM
| MICROSECOND_SYM
| MIGRATE_SYM
| MINUTE_SYM
| MIN_ROWS
| MODIFY_SYM
| MODE_SYM
| MONTH_SYM
| MULTILINESTRING
| MULTIPOINT
| MULTIPOLYGON
| MUTEX_SYM
| NAME_SYM
| NAMES_SYM
| NATIONAL_SYM
| NCHAR_SYM
| NDBCLUSTER_SYM
| NEXT_SYM
| NEW_SYM
| NO_WAIT_SYM
| NODEGROUP_SYM
| NONE_SYM
| NVARCHAR_SYM
| OFFSET_SYM
| OLD_PASSWORD
| ONE_SHOT_SYM
| ONE_SYM
| PACK_KEYS_SYM
| PARTIAL
| PARTITIONING_SYM
| PARTITIONS_SYM
| PASSWORD
| PHASE_SYM
| PLUGIN_SYM
| PLUGINS_SYM
| POINT_SYM
| POLYGON
| PRESERVE_SYM
| PREV_SYM
| PRIVILEGES
| PROCESS
| PROCESSLIST_SYM
| QUARTER_SYM
| QUERY_SYM
| QUICK
| REBUILD_SYM
| RECOVER_SYM
| REDO_BUFFER_SIZE_SYM
| REDOFILE_SYM
| REDUNDANT_SYM
| RELAY_LOG_FILE_SYM
| RELAY_LOG_POS_SYM
| RELAY_THREAD
| RELOAD
| REORGANIZE_SYM
| REPEATABLE_SYM
| REPLICATION
| RESOURCES
| RESUME_SYM
| RETURNS_SYM
| ROLLUP_SYM
| ROUTINE_SYM
| ROWS_SYM
| ROW_FORMAT_SYM
| ROW_SYM
| RTREE_SYM
| SCHEDULE_SYM
| SECOND_SYM
| SERIAL_SYM
| SERIALIZABLE_SYM
| SESSION_SYM
| SIMPLE_SYM
| SHARE_SYM
| SHUTDOWN
| SNAPSHOT_SYM
| SOUNDS_SYM
| SQL_CACHE_SYM
| SQL_BUFFER_RESULT
| SQL_NO_CACHE_SYM
| SQL_THREAD
| STARTS_SYM
| STATUS_SYM
| STORAGE_SYM
| STRING_SYM
| SUBDATE_SYM
| SUBJECT_SYM
| SUBPARTITION_SYM
| SUBPARTITIONS_SYM
| SUPER_SYM
| SUSPEND_SYM
| TABLES
| TABLESPACE
| TEMPORARY
| TEMPTABLE_SYM
| TEXT_SYM
| THAN_SYM
| TRANSACTION_SYM
| TRIGGERS_SYM
| TIMESTAMP
| TIMESTAMP_ADD
| TIMESTAMP_DIFF
| TIME_SYM
| TYPES_SYM
| TYPE_SYM
| UDF_RETURNS_SYM
| FUNCTION_SYM
| UNCOMMITTED_SYM
| UNDEFINED_SYM
| UNDO_BUFFER_SIZE_SYM
| UNDOFILE_SYM
| UNKNOWN_SYM
| UNTIL_SYM
| USER
| USE_FRM
| VARIABLES
| VIEW_SYM
| VALUE_SYM
| WARNINGS
| WAIT_SYM
| WEEK_SYM
| WORK_SYM
| X509_SYM
| YEAR_SYM;

set:
  SET opt_option option_value_list;

opt_option:
 
| OPTION;

option_value_list:
  option_type_value
| option_value_list ',' option_type_value;

option_type_value:
  ext_option_value;

option_type:
  option_type2
| GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM;

option_type2:
 
| ONE_SHOT_SYM;

opt_var_type:
 
| GLOBAL_SYM
| LOCAL_SYM
| SESSION_SYM;

opt_var_ident_type:
 
| GLOBAL_SYM '.'
| LOCAL_SYM '.'
| SESSION_SYM '.';

ext_option_value:
  sys_option_value
| option_type2 option_value;

sys_option_value:
  option_type internal_variable_name equal set_expr_or_default
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types;

option_value:
  '@' ident_or_text equal expr
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
| charset old_or_new_charset_name_or_default
| NAMES_SYM equal expr
| NAMES_SYM charset_name_or_default opt_collate
| PASSWORD equal text_or_password
| PASSWORD FOR_SYM user equal text_or_password;

internal_variable_name:
  ident
| ident '.' ident
| DEFAULT '.' ident;

isolation_types:
  READ_SYM UNCOMMITTED_SYM
| READ_SYM COMMITTED_SYM
| REPEATABLE_SYM READ_SYM
| SERIALIZABLE_SYM;

text_or_password:
  TEXT_STRING
| PASSWORD '(' TEXT_STRING ')'
| OLD_PASSWORD '(' TEXT_STRING ')';

set_expr_or_default:
  expr
| DEFAULT
| ON
| ALL
| BINARY;

lock:
  LOCK_SYM table_or_tables table_lock_list;

table_or_tables:
  TABLE_SYM
| TABLES;

table_lock_list:
  table_lock
| table_lock_list ',' table_lock;

table_lock:
  table_ident opt_table_alias lock_option;

lock_option:
  READ_SYM
| WRITE_SYM
| LOW_PRIORITY WRITE_SYM
| READ_SYM LOCAL_SYM;

unlock:
  UNLOCK_SYM table_or_tables;

handler:
  HANDLER_SYM table_ident OPEN_SYM opt_table_alias
| HANDLER_SYM table_ident_nodb CLOSE_SYM
| HANDLER_SYM table_ident_nodb READ_SYM handler_read_or_scan where_clause opt_limit_clause;

handler_read_or_scan:
  handler_scan_function
| ident handler_rkey_function;

handler_scan_function:
  FIRST_SYM
| NEXT_SYM;

handler_rkey_function:
  FIRST_SYM
| NEXT_SYM
| PREV_SYM
| LAST_SYM
| handler_rkey_mode '(' values ')';

handler_rkey_mode:
  EQ
| GE
| LE
| GT_SYM
| LT;

revoke:
  REVOKE clear_privileges revoke_command;

revoke_command:
  grant_privileges ON opt_table grant_ident FROM grant_list
| grant_privileges ON FUNCTION_SYM grant_ident FROM grant_list
| grant_privileges ON PROCEDURE grant_ident FROM grant_list
| ALL opt_privileges ',' GRANT OPTION FROM grant_list;

grant:
  GRANT clear_privileges grant_command;

grant_command:
  grant_privileges ON opt_table grant_ident TO_SYM grant_list require_clause grant_options
| grant_privileges ON FUNCTION_SYM grant_ident TO_SYM grant_list require_clause grant_options
| grant_privileges ON PROCEDURE grant_ident TO_SYM grant_list require_clause grant_options;

opt_table:
 
| TABLE_SYM;

grant_privileges:
  object_privilege_list
| ALL opt_privileges;

opt_privileges:
 
| PRIVILEGES;

object_privilege_list:
  object_privilege
| object_privilege_list ',' object_privilege;

object_privilege:
  SELECT_SYM opt_column_list
| INSERT opt_column_list
| UPDATE_SYM opt_column_list
| REFERENCES opt_column_list
| DELETE_SYM
| USAGE
| INDEX_SYM
| ALTER
| CREATE
| DROP
| EXECUTE_SYM
| RELOAD
| SHUTDOWN
| PROCESS
| FILE_SYM
| GRANT OPTION
| SHOW DATABASES
| SUPER_SYM
| CREATE TEMPORARY TABLES
| LOCK_SYM TABLES
| REPLICATION SLAVE
| REPLICATION CLIENT_SYM
| CREATE VIEW_SYM
| SHOW VIEW_SYM
| CREATE ROUTINE_SYM
| ALTER ROUTINE_SYM
| CREATE USER
| EVENT_SYM
| TRIGGER_SYM;

opt_and:
 
| AND_SYM;

require_list:
  require_list_element opt_and require_list
| require_list_element;

require_list_element:
  SUBJECT_SYM TEXT_STRING
| ISSUER_SYM TEXT_STRING
| CIPHER_SYM TEXT_STRING;

grant_ident:
  '*'
| ident '.' '*'
| '*' '.' '*'
| table_ident;

user_list:
  user
| user_list ',' user;

grant_list:
  grant_user
| grant_list ',' grant_user;

grant_user:
  user IDENTIFIED_SYM BY TEXT_STRING
| user IDENTIFIED_SYM BY PASSWORD TEXT_STRING
| user;

opt_column_list:
 
| '(' column_list ')';column_list:
  column_list ',' column_list_id
| column_list_id;

column_list_id:
  ident;

require_clause:
 
| REQUIRE_SYM require_list
| REQUIRE_SYM SSL_SYM
| REQUIRE_SYM X509_SYM
| REQUIRE_SYM NONE_SYM;

grant_options:
 
| WITH grant_option_list;

grant_option_list:
  grant_option_list grant_option
| grant_option;

grant_option:
  GRANT OPTION
| MAX_QUERIES_PER_HOUR ulong_num
| MAX_UPDATES_PER_HOUR ulong_num
| MAX_CONNECTIONS_PER_HOUR ulong_num
| MAX_USER_CONNECTIONS_SYM ulong_num;

begin:
  BEGIN_SYM opt_work;

opt_work:
 
| WORK_SYM;

opt_chain:
 
| AND_SYM NO_SYM CHAIN_SYM
| AND_SYM CHAIN_SYM;

opt_release:
 
| RELEASE_SYM
| NO_SYM RELEASE_SYM;

opt_savepoint:
 
| SAVEPOINT_SYM;

commit:
  COMMIT_SYM opt_work opt_chain opt_release;

rollback:
  ROLLBACK_SYM opt_work opt_chain opt_release
| ROLLBACK_SYM opt_work TO_SYM opt_savepoint ident;

savepoint:
  SAVEPOINT_SYM ident;

release:
  RELEASE_SYM SAVEPOINT_SYM ident;

union_clause:
 
| union_list;

union_list:
  UNION_SYM union_option select_init;

union_opt:
 
| union_list
| union_order_or_limit;

union_order_or_limit:
  order_or_limit;

order_or_limit:
  order_clause opt_limit_clause_init
| limit_clause;

union_option:
 
| DISTINCT
| ALL;

subselect:
  SELECT_SYM subselect_start subselect_init subselect_end
| '(' subselect_start subselect ')' union_clause subselect_end;

subselect_init:
  select_init2;

subselect_start:
 ;

subselect_end:
 ;

view_or_trigger_or_sp_or_event:
  definer view_or_trigger_or_sp_or_event_tail
| view_replace_or_algorithm definer view_tail;

view_or_trigger_or_sp_or_event_tail:
  view_tail
| trigger_tail
| sp_tail
| event_tail;

definer:
 
| DEFINER_SYM EQ user;

view_replace_or_algorithm:
  view_replace
| view_replace view_algorithm
| view_algorithm;

view_replace:
  OR_SYM REPLACE;

view_algorithm:
  ALGORITHM_SYM EQ UNDEFINED_SYM
| ALGORITHM_SYM EQ MERGE_SYM
| ALGORITHM_SYM EQ TEMPTABLE_SYM;

view_suid:
 
| SQL_SYM SECURITY_SYM DEFINER_SYM
| SQL_SYM SECURITY_SYM INVOKER_SYM;

view_tail:
  view_suid VIEW_SYM table_ident view_list_opt AS view_select view_check_option;

view_list_opt:
 
| '(' view_list ')';

view_list:
  ident
| view_list ',' ident;

view_select:
  view_select_aux;

view_select_aux:
  SELECT_SYM remember_name select_init2
| '(' remember_name select_paren ')' union_opt;

view_check_option:
 
| WITH CHECK_SYM OPTION
| WITH CASCADED CHECK_SYM OPTION
| WITH LOCAL_SYM CHECK_SYM OPTION;

trigger_tail:
  TRIGGER_SYM remember_name sp_name trg_action_time trg_event ON remember_name table_ident FOR_SYM remember_name EACH_SYM ROW_SYM sp_proc_stmt;

sp_tail:
  udf_func_type remember_name FUNCTION_SYM sp_name create_function_tail
| PROCEDURE remember_name sp_name '(' sp_pdparam_list ')' sp_c_chistics sp_proc_stmt;

xa:
  XA_SYM begin_or_start xid opt_join_or_resume
| XA_SYM END xid opt_suspend
| XA_SYM PREPARE_SYM xid
| XA_SYM COMMIT_SYM xid opt_one_phase
| XA_SYM ROLLBACK_SYM xid
| XA_SYM RECOVER_SYM;

xid:
  text_string
| text_string ',' text_string
| text_string ',' text_string ',' ulong_num;

begin_or_start:
  BEGIN_SYM
| START_SYM;

opt_join_or_resume:
 
| JOIN_SYM
| RESUME_SYM;

opt_one_phase:
 
| ONE_SYM PHASE_SYM;

opt_suspend:
 
| SUSPEND_SYM opt_migrate;

opt_migrate:
 
| FOR_SYM MIGRATE_SYM;

install:
  INSTALL_SYM PLUGIN_SYM ident SONAME_SYM TEXT_STRING_sys;

uninstall:
  UNINSTALL_SYM PLUGIN_SYM ident;