summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/mysqldump.test
blob: c7874aa482d52b9097e5a768135ed0158407f769 (plain)
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
--source include/no_valgrind_without_big.inc
--source include/have_utf8mb4.inc

call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
#select * from mysql.user;
#checksum table mysql.user;
# Embedded server doesn't support external clients
--source include/not_embedded.inc

# Binlog is required
--source include/have_log_bin.inc

# utf8 is required
let collation=utf8mb3_unicode_ci;
--source include/have_collation.inc

# Save the initial number of concurrent sessions
--source include/count_sessions.inc

# There are tables in 'mysql' database of type innodb
--source include/have_innodb.inc

call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");

--echo # Bug#37938 Test "mysqldump" lacks various insert statements
--echo # Turn off concurrent inserts to avoid random errors
--echo # NOTE:  We reset the variable back to saved value at the end of test
SET @OLD_CONCURRENT_INSERT = @@GLOBAL.CONCURRENT_INSERT;
SET @@GLOBAL.CONCURRENT_INSERT = 0;

# XML output

CREATE TABLE t1(a INT, KEY (a)) KEY_BLOCK_SIZE=1024;
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --skip-create-options --skip-comments -X test t1
DROP TABLE t1;

--echo #
--echo # Bug#2005 Long decimal comparison bug.
--echo #

CREATE TABLE t1 (a decimal(64, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;

--echo #
--echo # Bug#2055 mysqldump should replace "-inf" numeric field values with "NULL"
--echo #

CREATE TABLE t1 (a double);
INSERT IGNORE INTO t1 VALUES ('-9e999999');
--exec $MYSQL_DUMP --compact test t1
DROP TABLE t1;

--echo #
--echo # Bug#3361 mysqldump quotes DECIMAL values inconsistently
--echo #

CREATE TABLE t1 (a DECIMAL(10,5), b FLOAT);

# check at first how mysql work with quoted decimal

INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
INSERT INTO t1 VALUES ("1.2345", 2.3456);

SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ANSI_QUOTES';
INSERT INTO t1 VALUES (1.2345, 2.3456);
INSERT INTO t1 VALUES ('1.2345', 2.3456);
--error ER_BAD_FIELD_ERROR
INSERT INTO t1 VALUES ("1.2345", 2.3456);
SET SQL_MODE=@OLD_SQL_MODE;

# check how mysqldump make quoting
--exec $MYSQL_DUMP --compact --default-character-set=utf8mb4 test t1
--exec $MYSQL_DUMP --compact --skip-create-options --default-character-set=utf8mb4 test t1
--exec $MYSQL_DUMP --skip-create-options --skip-comments --default-character-set=utf8mb4 test t1
--exec $MYSQL_DUMP --skip-opt --extended-insert --skip-comments --default-character-set=utf8mb4 test t1
DROP TABLE t1;

CREATE TABLE t1(a int, b text, c varchar(3));
INSERT INTO t1 VALUES (1, "test", "tes"), (2, "TEST", "TES");
--exec $MYSQL_DUMP --skip-create-options --compact -X test t1
DROP TABLE t1;

--echo #
--echo # Bug#1707 mysqldump -X does't quote field and table names
--echo #

CREATE TABLE t1 (`a"b"` char(2));
INSERT INTO t1 VALUES ("1\""), ("\"2");
--exec $MYSQL_DUMP --compact --skip-create-options -X test t1
DROP TABLE t1;

--echo #
--echo # Bug#1994 mysqldump does not correctly dump UCS2 data
--echo # Bug#4261 mysqldump 10.7 (mysql 4.1.2) --skip-extended-insert drops NULL from inserts
--echo #

CREATE TABLE t1 (a  VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1  VALUES (_koi8r x'C1C2C3C4C5'), (NULL);
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --default-character-set=utf8mb4 test t1
DROP TABLE t1;

--echo #
--echo # Bug#2634 mysqldump in --compatible=mysql4
--echo #

CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --compatible=mysql40 test t1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --compatible=mysql323 test t1
DROP TABLE t1;

--echo #
--echo # Bug#2592 mysqldump doesn't quote "tricky" names correctly
--echo #

create table ```a` (i int);
--exec $MYSQL_DUMP --compact test
drop table ```a`;

--echo #
--echo # Bug#2591 mysqldump quotes names inconsistently
--echo #

create table t1(a int);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --comments=0 test
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --comments=0 --compatible=ansi test
set global sql_mode='ANSI_QUOTES';
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --comments=0 test
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --comments=0 --compatible=ansi test
set global sql_mode=default;
drop table t1;

--echo #
--echo # Bug#2705 mysqldump --tab extra output
--echo #

create table t1(a int);
insert into t1 values (1),(2),(3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test
--cat_file $MYSQLTEST_VARDIR/tmp/t1.sql
--cat_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ test
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
drop table t1;

--echo #
--echo # Bug#6101 create database problem
--echo #

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test

create database mysqldump_test_db character set latin2 collate latin2_bin;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases mysqldump_test_db
drop database mysqldump_test_db;

--echo #
--echo # Bug#7020 mysqldump --compatible=mysql40 should set --skip-set-charset --default-char...
--echo # Check that we don't dump in UTF8 in compatible mode by default,
--echo # but use the default compiled values, or the values given in
--echo # --default-character-set=xxx. However, we should dump in UTF8
--echo # if it is explicitly set.

CREATE TABLE t1 (a  CHAR(10));
INSERT INTO t1  VALUES (_latin1 '����');
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments test t1

--echo #
--echo # Bug#8063 make test mysqldump [ fail ]
--echo # We cannot test this command because its output depends
--echo # on --default-character-set incompiled into "mysqldump" program.
--echo # If the future we can move this command into a separate test with
--echo # checking that "mysqldump" is compiled with "latin1"
--echo #

#--exec $MYSQL_DUMP --default-character-set=utf8mb4 --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --compatible=mysql323 --default-character-set=cp850 test t1
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=cp850 --compatible=mysql323 test t1
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test t1
DROP TABLE t1;

--echo #
--echo # WL#2319 Exclude Tables from dump
--echo #

CREATE TABLE t1 (a int);
CREATE TABLE t2 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t2 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --ignore-table=test.t1 test
DROP TABLE t1;
DROP TABLE t2;

--echo #
--echo # Bug#8830 mysqldump --skip-extended-insert causes --hex-blob to dump wrong values
--echo #

CREATE TABLE t1 (`b` blob);
INSERT INTO `t1` VALUES (0x602010000280100005E71A);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-extended-insert --hex-blob test --skip-comments t1
DROP TABLE t1;

--echo #
--echo # Test for --insert-ignore
--echo #

CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1),(2),(3);
INSERT INTO t1 VALUES (4),(5),(6);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --insert-ignore test t1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --insert-ignore --delayed-insert test t1
DROP TABLE t1;

--echo #
--echo # Bug#10286 mysqldump -c crashes on table that has many fields with long
--echo #           names
--echo #
create table t1 (
 F_c4ca4238a0b923820dcc509a6f75849b int,
 F_c81e728d9d4c2f636f067f89cc14862c int,
 F_eccbc87e4b5ce2fe28308fd9f2a7baf3 int,
 F_a87ff679a2f3e71d9181a67b7542122c int,
 F_e4da3b7fbbce2345d7772b0674a318d5 int,
 F_1679091c5a880faf6fb5e6087eb1b2dc int,
 F_8f14e45fceea167a5a36dedd4bea2543 int,
 F_c9f0f895fb98ab9159f51fd0297e236d int,
 F_45c48cce2e2d7fbdea1afc51c7c6ad26 int,
 F_d3d9446802a44259755d38e6d163e820 int,
 F_6512bd43d9caa6e02c990b0a82652dca int,
 F_c20ad4d76fe97759aa27a0c99bff6710 int,
 F_c51ce410c124a10e0db5e4b97fc2af39 int,
 F_aab3238922bcc25a6f606eb525ffdc56 int,
 F_9bf31c7ff062936a96d3c8bd1f8f2ff3 int,
 F_c74d97b01eae257e44aa9d5bade97baf int,
 F_70efdf2ec9b086079795c442636b55fb int,
 F_6f4922f45568161a8cdf4ad2299f6d23 int,
 F_1f0e3dad99908345f7439f8ffabdffc4 int,
 F_98f13708210194c475687be6106a3b84 int,
 F_3c59dc048e8850243be8079a5c74d079 int,
 F_b6d767d2f8ed5d21a44b0e5886680cb9 int,
 F_37693cfc748049e45d87b8c7d8b9aacd int,
 F_1ff1de774005f8da13f42943881c655f int,
 F_8e296a067a37563370ded05f5a3bf3ec int,
 F_4e732ced3463d06de0ca9a15b6153677 int,
 F_02e74f10e0327ad868d138f2b4fdd6f0 int,
 F_33e75ff09dd601bbe69f351039152189 int,
 F_6ea9ab1baa0efb9e19094440c317e21b int,
 F_34173cb38f07f89ddbebc2ac9128303f int,
 F_c16a5320fa475530d9583c34fd356ef5 int,
 F_6364d3f0f495b6ab9dcf8d3b5c6e0b01 int,
 F_182be0c5cdcd5072bb1864cdee4d3d6e int,
 F_e369853df766fa44e1ed0ff613f563bd int,
 F_1c383cd30b7c298ab50293adfecb7b18 int,
 F_19ca14e7ea6328a42e0eb13d585e4c22 int,
 F_a5bfc9e07964f8dddeb95fc584cd965d int,
 F_a5771bce93e200c36f7cd9dfd0e5deaa int,
 F_d67d8ab4f4c10bf22aa353e27879133c int,
 F_d645920e395fedad7bbbed0eca3fe2e0 int,
 F_3416a75f4cea9109507cacd8e2f2aefc int,
 F_a1d0c6e83f027327d8461063f4ac58a6 int,
 F_17e62166fc8586dfa4d1bc0e1742c08b int,
 F_f7177163c833dff4b38fc8d2872f1ec6 int,
 F_6c8349cc7260ae62e3b1396831a8398f int,
 F_d9d4f495e875a2e075a1a4a6e1b9770f int,
 F_67c6a1e7ce56d3d6fa748ab6d9af3fd7 int,
 F_642e92efb79421734881b53e1e1b18b6 int,
 F_f457c545a9ded88f18ecee47145a72c0 int,
 F_c0c7c76d30bd3dcaefc96f40275bdc0a int,
 F_2838023a778dfaecdc212708f721b788 int,
 F_9a1158154dfa42caddbd0694a4e9bdc8 int,
 F_d82c8d1619ad8176d665453cfb2e55f0 int,
 F_a684eceee76fc522773286a895bc8436 int,
 F_b53b3a3d6ab90ce0268229151c9bde11 int,
 F_9f61408e3afb633e50cdf1b20de6f466 int,
 F_72b32a1f754ba1c09b3695e0cb6cde7f int,
 F_66f041e16a60928b05a7e228a89c3799 int,
 F_093f65e080a295f8076b1c5722a46aa2 int,
 F_072b030ba126b2f4b2374f342be9ed44 int,
 F_7f39f8317fbdb1988ef4c628eba02591 int,
 F_44f683a84163b3523afe57c2e008bc8c int,
 F_03afdbd66e7929b125f8597834fa83a4 int,
 F_ea5d2f1c4608232e07d3aa3d998e5135 int,
 F_fc490ca45c00b1249bbe3554a4fdf6fb int,
 F_3295c76acbf4caaed33c36b1b5fc2cb1 int,
 F_735b90b4568125ed6c3f678819b6e058 int,
 F_a3f390d88e4c41f2747bfa2f1b5f87db int,
 F_14bfa6bb14875e45bba028a21ed38046 int,
 F_7cbbc409ec990f19c78c75bd1e06f215 int,
 F_e2c420d928d4bf8ce0ff2ec19b371514 int,
 F_32bb90e8976aab5298d5da10fe66f21d int,
 F_d2ddea18f00665ce8623e36bd4e3c7c5 int,
 F_ad61ab143223efbc24c7d2583be69251 int,
 F_d09bf41544a3365a46c9077ebb5e35c3 int,
 F_fbd7939d674997cdb4692d34de8633c4 int,
 F_28dd2c7955ce926456240b2ff0100bde int,
 F_35f4a8d465e6e1edc05f3d8ab658c551 int,
 F_d1fe173d08e959397adf34b1d77e88d7 int,
 F_f033ab37c30201f73f142449d037028d int,
 F_43ec517d68b6edd3015b3edc9a11367b int,
 F_9778d5d219c5080b9a6a17bef029331c int,
 F_fe9fc289c3ff0af142b6d3bead98a923 int,
 F_68d30a9594728bc39aa24be94b319d21 int,
 F_3ef815416f775098fe977004015c6193 int,
 F_93db85ed909c13838ff95ccfa94cebd9 int,
 F_c7e1249ffc03eb9ded908c236bd1996d int,
 F_2a38a4a9316c49e5a833517c45d31070 int,
 F_7647966b7343c29048673252e490f736 int,
 F_8613985ec49eb8f757ae6439e879bb2a int,
 F_54229abfcfa5649e7003b83dd4755294 int,
 F_92cc227532d17e56e07902b254dfad10 int,
 F_98dce83da57b0395e163467c9dae521b int,
 F_f4b9ec30ad9f68f89b29639786cb62ef int,
 F_812b4ba287f5ee0bc9d43bbf5bbe87fb int,
 F_26657d5ff9020d2abefe558796b99584 int,
 F_e2ef524fbf3d9fe611d5a8e90fefdc9c int,
 F_ed3d2c21991e3bef5e069713af9fa6ca int,
 F_ac627ab1ccbdb62ec96e702f07f6425b int,
 F_f899139df5e1059396431415e770c6dd int,
 F_38b3eff8baf56627478ec76a704e9b52 int,
 F_ec8956637a99787bd197eacd77acce5e int,
 F_6974ce5ac660610b44d9b9fed0ff9548 int,
 F_c9e1074f5b3f9fc8ea15d152add07294 int,
 F_65b9eea6e1cc6bb9f0cd2a47751a186f int,
 F_f0935e4cd5920aa6c7c996a5ee53a70f int,
 F_a97da629b098b75c294dffdc3e463904 int,
 F_a3c65c2974270fd093ee8a9bf8ae7d0b int,
 F_2723d092b63885e0d7c260cc007e8b9d int,
 F_5f93f983524def3dca464469d2cf9f3e int,
 F_698d51a19d8a121ce581499d7b701668 int,
 F_7f6ffaa6bb0b408017b62254211691b5 int,
 F_73278a4a86960eeb576a8fd4c9ec6997 int,
 F_5fd0b37cd7dbbb00f97ba6ce92bf5add int,
 F_2b44928ae11fb9384c4cf38708677c48 int,
 F_c45147dee729311ef5b5c3003946c48f int,
 F_eb160de1de89d9058fcb0b968dbbbd68 int,
 F_5ef059938ba799aaa845e1c2e8a762bd int,
 F_07e1cd7dca89a1678042477183b7ac3f int,
 F_da4fb5c6e93e74d3df8527599fa62642 int,
 F_4c56ff4ce4aaf9573aa5dff913df997a int,
 F_a0a080f42e6f13b3a2df133f073095dd int,
 F_202cb962ac59075b964b07152d234b70 int,
 F_c8ffe9a587b126f152ed3d89a146b445 int,
 F_3def184ad8f4755ff269862ea77393dd int,
 F_069059b7ef840f0c74a814ec9237b6ec int,
 F_ec5decca5ed3d6b8079e2e7e7bacc9f2 int,
 F_76dc611d6ebaafc66cc0879c71b5db5c int,
 F_d1f491a404d6854880943e5c3cd9ca25 int,
 F_9b8619251a19057cff70779273e95aa6 int,
 F_1afa34a7f984eeabdbb0a7d494132ee5 int,
 F_65ded5353c5ee48d0b7d48c591b8f430 int,
 F_9fc3d7152ba9336a670e36d0ed79bc43 int,
 F_02522a2b2726fb0a03bb19f2d8d9524d int,
 F_7f1de29e6da19d22b51c68001e7e0e54 int,
 F_42a0e188f5033bc65bf8d78622277c4e int,
 F_3988c7f88ebcb58c6ce932b957b6f332 int,
 F_013d407166ec4fa56eb1e1f8cbe183b9 int,
 F_e00da03b685a0dd18fb6a08af0923de0 int,
 F_1385974ed5904a438616ff7bdb3f7439 int,
 F_0f28b5d49b3020afeecd95b4009adf4c int,
 F_a8baa56554f96369ab93e4f3bb068c22 int,
 F_903ce9225fca3e988c2af215d4e544d3 int,
 F_0a09c8844ba8f0936c20bd791130d6b6 int,
 F_2b24d495052a8ce66358eb576b8912c8 int,
 F_a5e00132373a7031000fd987a3c9f87b int,
 F_8d5e957f297893487bd98fa830fa6413 int,
 F_47d1e990583c9c67424d369f3414728e int,
 F_f2217062e9a397a1dca429e7d70bc6ca int,
 F_7ef605fc8dba5425d6965fbd4c8fbe1f int,
 F_a8f15eda80c50adb0e71943adc8015cf int,
 F_37a749d808e46495a8da1e5352d03cae int,
 F_b3e3e393c77e35a4a3f3cbd1e429b5dc int,
 F_1d7f7abc18fcb43975065399b0d1e48e int,
 F_2a79ea27c279e471f4d180b08d62b00a int,
 F_1c9ac0159c94d8d0cbedc973445af2da int,
 F_6c4b761a28b734fe93831e3fb400ce87 int,
 F_06409663226af2f3114485aa4e0a23b4 int,
 F_140f6969d5213fd0ece03148e62e461e int,
 F_b73ce398c39f506af761d2277d853a92 int,
 F_bd4c9ab730f5513206b999ec0d90d1fb int,
 F_82aa4b0af34c2313a562076992e50aa3 int,
 F_0777d5c17d4066b82ab86dff8a46af6f int,
 F_fa7cdfad1a5aaf8370ebeda47a1ff1c3 int,
 F_9766527f2b5d3e95d4a733fcfb77bd7e int,
 F_7e7757b1e12abcb736ab9a754ffb617a int,
 F_5878a7ab84fb43402106c575658472fa int,
 F_006f52e9102a8d3be2fe5614f42ba989 int,
 F_3636638817772e42b59d74cff571fbb3 int,
 F_149e9677a5989fd342ae44213df68868 int,
 F_a4a042cf4fd6bfb47701cbc8a1653ada int,
 F_1ff8a7b5dc7a7d1f0ed65aaa29c04b1e int,
 F_f7e6c85504ce6e82442c770f7c8606f0 int,
 F_bf8229696f7a3bb4700cfddef19fa23f int,
 F_82161242827b703e6acf9c726942a1e4 int,
 F_38af86134b65d0f10fe33d30dd76442e int,
 F_96da2f590cd7246bbde0051047b0d6f7 int,
 F_8f85517967795eeef66c225f7883bdcb int,
 F_8f53295a73878494e9bc8dd6c3c7104f int,
 F_045117b0e0a11a242b9765e79cbf113f int,
 F_fc221309746013ac554571fbd180e1c8 int,
 F_4c5bde74a8f110656874902f07378009 int,
 F_cedebb6e872f539bef8c3f919874e9d7 int,
 F_6cdd60ea0045eb7a6ec44c54d29ed402 int,
 F_eecca5b6365d9607ee5a9d336962c534 int,
 F_9872ed9fc22fc182d371c3e9ed316094 int,
 F_31fefc0e570cb3860f2a6d4b38c6490d int,
 F_9dcb88e0137649590b755372b040afad int,
 F_a2557a7b2e94197ff767970b67041697 int,
 F_cfecdb276f634854f3ef915e2e980c31 int,
 F_0aa1883c6411f7873cb83dacb17b0afc int,
 F_58a2fc6ed39fd083f55d4182bf88826d int,
 F_bd686fd640be98efaae0091fa301e613 int,
 F_a597e50502f5ff68e3e25b9114205d4a int,
 F_0336dcbab05b9d5ad24f4333c7658a0e int,
 F_084b6fbb10729ed4da8c3d3f5a3ae7c9 int,
 F_85d8ce590ad8981ca2c8286f79f59954 int,
 F_0e65972dce68dad4d52d063967f0a705 int,
 F_84d9ee44e457ddef7f2c4f25dc8fa865 int,
 F_3644a684f98ea8fe223c713b77189a77 int,
 F_757b505cfd34c64c85ca5b5690ee5293 int,
 F_854d6fae5ee42911677c739ee1734486 int,
 F_e2c0be24560d78c5e599c2a9c9d0bbd2 int,
 F_274ad4786c3abca69fa097b85867d9a4 int,
 F_eae27d77ca20db309e056e3d2dcd7d69 int,
 F_7eabe3a1649ffa2b3ff8c02ebfd5659f int,
 F_69adc1e107f7f7d035d7baf04342e1ca int,
 F_091d584fced301b442654dd8c23b3fc9 int,
 F_b1d10e7bafa4421218a51b1e1f1b0ba2 int,
 F_6f3ef77ac0e3619e98159e9b6febf557 int,
 F_eb163727917cbba1eea208541a643e74 int,
 F_1534b76d325a8f591b52d302e7181331 int,
 F_979d472a84804b9f647bc185a877a8b5 int,
 F_ca46c1b9512a7a8315fa3c5a946e8265 int,
 F_3b8a614226a953a8cd9526fca6fe9ba5 int,
 F_45fbc6d3e05ebd93369ce542e8f2322d int,
 F_63dc7ed1010d3c3b8269faf0ba7491d4 int,
 F_e96ed478dab8595a7dbda4cbcbee168f int,
 F_c0e190d8267e36708f955d7ab048990d int,
 F_ec8ce6abb3e952a85b8551ba726a1227 int,
 F_060ad92489947d410d897474079c1477 int,
 F_bcbe3365e6ac95ea2c0343a2395834dd int,
 F_115f89503138416a242f40fb7d7f338e int,
 F_13fe9d84310e77f13a6d184dbf1232f3 int,
 F_d1c38a09acc34845c6be3a127a5aacaf int,
 F_9cfdf10e8fc047a44b08ed031e1f0ed1 int,
 F_705f2172834666788607efbfca35afb3 int,
 F_74db120f0a8e5646ef5a30154e9f6deb int,
 F_57aeee35c98205091e18d1140e9f38cf int,
 F_6da9003b743b65f4c0ccd295cc484e57 int,
 F_9b04d152845ec0a378394003c96da594 int,
 F_be83ab3ecd0db773eb2dc1b0a17836a1 int,
 F_e165421110ba03099a1c0393373c5b43 int,
 F_289dff07669d7a23de0ef88d2f7129e7 int,
 F_577ef1154f3240ad5b9b413aa7346a1e int,
 F_01161aaa0b6d1345dd8fe4e481144d84 int,
 F_539fd53b59e3bb12d203f45a912eeaf2 int,
 F_ac1dd209cbcc5e5d1c6e28598e8cbbe8 int,
 F_555d6702c950ecb729a966504af0a635 int,
 F_335f5352088d7d9bf74191e006d8e24c int,
 F_f340f1b1f65b6df5b5e3f94d95b11daf int,
 F_e4a6222cdb5b34375400904f03d8e6a5 int,
 F_cb70ab375662576bd1ac5aaf16b3fca4 int,
 F_9188905e74c28e489b44e954ec0b9bca int,
 F_0266e33d3f546cb5436a10798e657d97 int,
 F_38db3aed920cf82ab059bfccbd02be6a int,
 F_3cec07e9ba5f5bb252d13f5f431e4bbb int,
 F_621bf66ddb7c962aa0d22ac97d69b793 int,
 F_077e29b11be80ab57e1a2ecabb7da330 int,
 F_6c9882bbac1c7093bd25041881277658 int,
 F_19f3cd308f1455b3fa09a282e0d496f4 int,
 F_03c6b06952c750899bb03d998e631860 int,
 F_c24cd76e1ce41366a4bbe8a49b02a028 int,
 F_c52f1bd66cc19d05628bd8bf27af3ad6 int,
 F_fe131d7f5a6b38b23cc967316c13dae2 int,
 F_f718499c1c8cef6730f9fd03c8125cab int,
 F_d96409bf894217686ba124d7356686c9 int,
 F_502e4a16930e414107ee22b6198c578f int,
 F_cfa0860e83a4c3a763a7e62d825349f7 int,
 F_a4f23670e1833f3fdb077ca70bbd5d66 int,
 F_b1a59b315fc9a3002ce38bbe070ec3f5 int,
 F_36660e59856b4de58a219bcf4e27eba3 int,
 F_8c19f571e251e61cb8dd3612f26d5ecf int,
 F_d6baf65e0b240ce177cf70da146c8dc8 int,
 F_e56954b4f6347e897f954495eab16a88 int,
 F_f7664060cc52bc6f3d620bcedc94a4b6 int,
 F_eda80a3d5b344bc40f3bc04f65b7a357 int,
 F_8f121ce07d74717e0b1f21d122e04521 int,
 F_06138bc5af6023646ede0e1f7c1eac75 int,
 F_39059724f73a9969845dfe4146c5660e int,
 F_7f100b7b36092fb9b06dfb4fac360931 int,
 F_7a614fd06c325499f1680b9896beedeb int,
 F_4734ba6f3de83d861c3176a6273cac6d int,
 F_d947bf06a885db0d477d707121934ff8 int,
 F_63923f49e5241343aa7acb6a06a751e7 int,
 F_db8e1af0cb3aca1ae2d0018624204529 int,
 F_20f07591c6fcb220ffe637cda29bb3f6 int,
 F_07cdfd23373b17c6b337251c22b7ea57 int,
 F_d395771085aab05244a4fb8fd91bf4ee int,
 F_92c8c96e4c37100777c7190b76d28233 int,
 F_e3796ae838835da0b6f6ea37bcf8bcb7 int,
 F_6a9aeddfc689c1d0e3b9ccc3ab651bc5 int,
 F_0f49c89d1e7298bb9930789c8ed59d48 int,
 F_46ba9f2a6976570b0353203ec4474217 int,
 F_0e01938fc48a2cfb5f2217fbfb00722d int,
 F_16a5cdae362b8d27a1d8f8c7b78b4330 int,
 F_918317b57931b6b7a7d29490fe5ec9f9 int,
 F_48aedb8880cab8c45637abc7493ecddd int,
 F_839ab46820b524afda05122893c2fe8e int,
 F_f90f2aca5c640289d0a29417bcb63a37 int,
 F_9c838d2e45b2ad1094d42f4ef36764f6 int,
 F_1700002963a49da13542e0726b7bb758 int,
 F_53c3bce66e43be4f209556518c2fcb54 int,
 F_6883966fd8f918a4aa29be29d2c386fb int,
 F_49182f81e6a13cf5eaa496d51fea6406 int,
 F_d296c101daa88a51f6ca8cfc1ac79b50 int,
 F_9fd81843ad7f202f26c1a174c7357585 int,
 F_26e359e83860db1d11b6acca57d8ea88 int,
 F_ef0d3930a7b6c95bd2b32ed45989c61f int,
 F_94f6d7e04a4d452035300f18b984988c int,
 F_34ed066df378efacc9b924ec161e7639 int,
 F_577bcc914f9e55d5e4e4f82f9f00e7d4 int,
 F_11b9842e0a271ff252c1903e7132cd68 int,
 F_37bc2f75bf1bcfe8450a1a41c200364c int,
 F_496e05e1aea0a9c4655800e8a7b9ea28 int,
 F_b2eb7349035754953b57a32e2841bda5 int,
 F_8e98d81f8217304975ccb23337bb5761 int,
 F_a8c88a0055f636e4a163a5e3d16adab7 int,
 F_eddea82ad2755b24c4e168c5fc2ebd40 int,
 F_06eb61b839a0cefee4967c67ccb099dc int,
 F_9dfcd5e558dfa04aaf37f137a1d9d3e5 int,
 F_950a4152c2b4aa3ad78bdd6b366cc179 int,
 F_158f3069a435b314a80bdcb024f8e422 int,
 F_758874998f5bd0c393da094e1967a72b int,
 F_ad13a2a07ca4b7642959dc0c4c740ab6 int,
 F_3fe94a002317b5f9259f82690aeea4cd int,
 F_5b8add2a5d98b1a652ea7fd72d942dac int,
 F_432aca3a1e345e339f35a30c8f65edce int,
 F_8d3bba7425e7c98c50f52ca1b52d3735 int,
 F_320722549d1751cf3f247855f937b982 int,
 F_caf1a3dfb505ffed0d024130f58c5cfa int,
 F_5737c6ec2e0716f3d8a7a5c4e0de0d9a int,
 F_bc6dc48b743dc5d013b1abaebd2faed2 int,
 F_f2fc990265c712c49d51a18a32b39f0c int,
 F_89f0fd5c927d466d6ec9a21b9ac34ffa int,
 F_a666587afda6e89aec274a3657558a27 int,
 F_b83aac23b9528732c23cc7352950e880 int,
 F_cd00692c3bfe59267d5ecfac5310286c int,
 F_6faa8040da20ef399b63a72d0e4ab575 int,
 F_fe73f687e5bc5280214e0486b273a5f9 int);
insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments -c test
drop table t1;

--echo #
--echo # Test for --add-drop-database
--echo #

CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1),(2),(3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --add-drop-database --skip-comments --databases test
DROP TABLE t1;

--echo #
--echo # Bug#9558 mysqldump --no-data db t1 t2 format still dumps data
--echo #

CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
INSERT INTO t1 VALUES (1), (2);
INSERT INTO t2 VALUES (1), (2);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --no-data mysqldump_test_db
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --no-data mysqldump_test_db t1 t2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --skip-create-options --xml --no-data mysqldump_test_db
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --skip-create-options --xml --no-data mysqldump_test_db t1 t2
DROP TABLE t1, t2;
DROP DATABASE mysqldump_test_db;

--echo #
--echo #  Testing with tables and databases that don't exists
--echo #  or contains illegal characters
--echo # (Bug#9358 mysqldump crashes if tablename starts with \)
--echo #
create database mysqldump_test_db;
use mysqldump_test_db;
create table t1(a varchar(30) primary key, b int not null);
create table t2(a varchar(30) primary key, b int not null);
create table t3(a varchar(30) primary key, b int not null);

--disable_query_log
select '------ Testing with illegal table names ------' as test_sequence ;
--enable_query_log
--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\d-2-1.sql" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db  "\t1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db  "\\t1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db  "\\\\t1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db  "t\1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments  mysqldump_test_db  "t\\1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db  "t/1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T%1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T'1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_1" 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "T_" 2>&1

--disable_query_log
select '------ Testing with illegal database names ------' as test_sequence ;
--enable_query_log
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_d 2>&1

--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --compact --skip-comments "mysqld\ump_test_db" 2>&1

drop table t1, t2, t3;
drop database mysqldump_test_db;
use test;


--echo #
--echo # Bug#9657 mysqldump xml ( -x ) does not format NULL fields correctly
--echo #

create table t1 (a int(10));
create table t2 (pk int primary key auto_increment,
a int(10), b varchar(30), c datetime, d blob, e text);
insert into t1 values (NULL), (10), (20);
insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thirty");
--exec $MYSQL_DUMP --default-character-set=utf8mb4  --skip-comments --xml --no-create-info test

# Test if UNIQUE_CHECK is done correctly
--exec $MYSQL_DUMP --default-character-set=utf8mb4  --skip-comments --no-create-info test
--exec $MYSQL_DUMP --default-character-set=utf8mb4  --skip-comments test
drop table t1, t2;


--echo #
--echo # Bug#12123 mysqldump --tab results in text file which can't be imported
--echo #

create table t1 (a text character set utf8, b text character set latin1);
insert t1 values (0x4F736E616272C3BC636B, 0x4BF66C6E);
select * from t1;
--exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ test
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL_IMPORT test $MYSQLTEST_VARDIR/tmp/t1.txt
select * from t1;

drop table t1;


--echo #
--echo # Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence
--echo #

--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump

--echo #
--echo # Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]"
--echo #

create table `t1` (
    t1_name varchar(255) default null,
    t1_id int(10) unsigned not null auto_increment,
    key (t1_name),
    primary key (t1_id)
) auto_increment = 1000 default charset=latin1;

insert into t1 (t1_name) values('bla');
insert into t1 (t1_name) values('bla');
insert into t1 (t1_name) values('bla');

select * from t1;

show create table `t1`;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments test t1 > $MYSQLTEST_VARDIR/tmp/bug19025.sql
DROP TABLE `t1`;

--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug19025.sql

select * from t1;

show create table `t1`;

drop table `t1`;
--remove_file $MYSQLTEST_VARDIR/tmp/bug19025.sql


--echo #
--echo # Bug#18536 wrong table order
--echo #

create table t1(a int);
create table t2(a int);
create table t3(a int);
--replace_result mariadb-dump.exe mariadb-dump
--error 6
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --force --no-data test t3 t1 non_existing t2 2>&1
drop table t1, t2, t3;


--echo #
--echo # Bug#21288 mysqldump segmentation fault when using --where
--echo #

create table t1 (a int);
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --force test t1 --where="xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 2>&1
drop table t1;


--echo #
--echo # Bug#13926 --order-by-primary fails if PKEY contains quote character
--echo #

--disable_warnings
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
  `a b` INT,
  `c"d` INT,
  `e``f` INT,
  PRIMARY KEY (`a b`, `c"d`, `e``f`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
insert into t1 values (0815, 4711, 2006);

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --compatible=ansi --order-by-primary test t1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --order-by-primary test t1
DROP TABLE `t1`;
--enable_warnings

--echo End of 4.1 tests


--echo #
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #

create database db1;
use db1;

CREATE TABLE t2 (
  a varchar(30) default NULL,
  KEY a (a(5))
);

INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --default-character-set=utf8mb4  --skip-comments db1
drop table t2;
drop view v2;
drop database db1;
use test;


--echo #
--echo # Bug#10713 mysqldump includes database in create view and referenced tables
--echo #

# create table and views in db2
create database db2;
use db2;
create table t1 (a int);
create table t2 (a int, b varchar(10), primary key(a));
insert into t2 values (1, "on"), (2, "off"), (10, "pol"), (12, "meg");
insert into t1 values (289), (298), (234), (456), (789);
create view v1 as select * from t2;
create view v2 as select * from t1;

# dump tables and view from db2
--exec $MYSQL_DUMP db2 > $MYSQLTEST_VARDIR/tmp/bug10713.sql

# drop the db, tables and views
drop table t1, t2;
drop view v1, v2;
drop database db2;
use test;

# create db1 and reload dump
create database db1;
use db1;
--exec $MYSQL db1 < $MYSQLTEST_VARDIR/tmp/bug10713.sql

# check that all tables and views could be created
show tables;
select * from t2 order by a;

drop table t1, t2;
drop database db1;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug10713.sql

#
# dump of view
#

create table t1(a int);
create view v1 as select * from t1;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments test
drop view v1;
drop table t1;


--echo #
--echo # Bug#10213 mysqldump crashes when dumping VIEWs(on MacOS X)
--echo #

create database mysqldump_test_db;
use mysqldump_test_db;

CREATE TABLE t2 (
  a varchar(30) default NULL,
  KEY a (a(5))
);

INSERT INTO t2 VALUES ('alfred');
INSERT INTO t2 VALUES ('angie');
INSERT INTO t2 VALUES ('bingo');
INSERT INTO t2 VALUES ('waffle');
INSERT INTO t2 VALUES ('lemon');
create view v2 as select * from t2 where a like 'a%' with check option;
--exec $MYSQL_DUMP --default-character-set=utf8mb4  --skip-comments mysqldump_test_db
drop table t2;
drop view v2;
drop database mysqldump_test_db;
use test;

--echo #
--echo # Bug#9756 mysql client failing on dumps containing certain \ sequences
--echo #

CREATE TABLE t1 (a char(10));
INSERT INTO t1 VALUES ('\'');
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments test t1
DROP TABLE t1;

--echo #
--echo # Bug#10927 mysqldump: Can't reload dump with view that consist of other view
--echo #

create table t1(a int, b int, c varchar(30));

insert into t1 values(1, 2, "one"), (2, 4, "two"), (3, 6, "three");

create view v3 as
select * from t1;

create  view v1 as
select * from v3 where b in (1, 2, 3, 4, 5, 6, 7);

create  view v2 as
select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments test

drop view v1, v2, v3;
drop table t1;

--echo #
--echo # Test for dumping triggers
--echo #

CREATE TABLE t1 (a int, b bigint default NULL);
CREATE TABLE t2 (a int);
delimiter |;
create trigger trg1 before insert on t1 for each row
begin
  if new.a > 10 then
    set new.a := 10;
    set new.a := 11;
  end if;
end|
create trigger trg2 before update on t1 for each row begin
  if old.a % 2 = 0 then set new.b := 12; end if;
end|
set sql_mode="traditional"|
create trigger trg3 after update on t1 for each row
begin
  if new.a = -1 then
    set @fired:= "Yes";
  end if;
end|
create trigger trg4 before insert on t2 for each row
begin
  if new.a > 10 then
    set @fired:= "No";
  end if;
end|
set sql_mode=default|
delimiter ;|
--replace_column 6 '0000-00-00 00:00:00'
show triggers like "t1";
INSERT INTO t1 (a) VALUES (1),(2),(3),(22);
update t1 set a = 4 where a=3;
# Triggers should be dumped by default
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test
# Skip dumping triggers
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases --skip-triggers test
# Dump and reload...
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test > $MYSQLTEST_VARDIR/tmp/mysqldump.sql
drop table t1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump.sql
# Check that tables have been reloaded
show tables;
--replace_column 6 #
show triggers;
DROP TABLE t1, t2;

--echo #
--echo # Bug#9136  my_print_defaults changed behaviour between 4.1.7 and 4.1.10a
--echo # Bug#12917 The --defaults-extra-file option is ignored by the 5.0 client binaries
--echo # (Problems with --defaults-extra-file option)
--echo #

--write_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
[mysqltest1]
port=1234
EOF
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
--remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf

--echo #
--echo # Test of fix to Bug#12597 mysqldump dumps triggers wrongly
--echo #

DROP TABLE IF EXISTS `test1`;
CREATE TABLE `test1` (
  `a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `test2`;
CREATE TABLE `test2` (
  `a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DELIMITER //;
CREATE TRIGGER `testref` BEFORE INSERT ON `test1` FOR EACH ROW BEGIN
INSERT INTO test2 SET a2 = NEW.a1; END  //
DELIMITER ;//

INSERT INTO `test1` VALUES (1);
SELECT * FROM `test2`;

# dump
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test > $MYSQLTEST_VARDIR/tmp/mysqldump.sql

#DROP TRIGGER testref;
#DROP TABLE test1;
#DROP TABLE test2;
# restore
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump.sql
--replace_column 6 #
SHOW TRIGGERS;
SELECT * FROM `test1`;
SELECT * FROM `test2`;

DROP TRIGGER testref;
DROP TABLE test1;
DROP TABLE test2;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump.sql


--echo #
--echo # Bug#9056 mysqldump does not dump routines
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1;
DROP FUNCTION IF EXISTS bug9056_func1;
DROP FUNCTION IF EXISTS bug9056_func2;
DROP PROCEDURE IF EXISTS bug9056_proc1;
DROP PROCEDURE IF EXISTS bug9056_proc2;
DROP PROCEDURE IF EXISTS `a'b`;
--enable_warnings

CREATE TABLE t1 (id int);
INSERT INTO t1 VALUES(1), (2), (3), (4), (5);

DELIMITER //;
CREATE FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11) RETURN a+b //
CREATE PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
BEGIN SELECT a+b INTO c; end  //

create function bug9056_func2(f1 char binary) returns char
begin
  set f1= concat( 'hello', f1 );
  return f1;
end //

--enable_prepare_warnings
CREATE PROCEDURE bug9056_proc2(OUT a INT)
BEGIN
  select sum(id) from t1 into a;
END //
--disable_prepare_warnings

DELIMITER ;//

set sql_mode='ansi';
create procedure `a'b` () select 1; # to fix syntax highlighting :')
set sql_mode='';

# Dump the DB and ROUTINES
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --routines --databases test

# ok, now blow it all away
DROP FUNCTION bug9056_func1;
DROP FUNCTION bug9056_func2;
DROP PROCEDURE bug9056_proc1;
DROP PROCEDURE bug9056_proc2;
DROP PROCEDURE `a'b`;
drop table t1;


--echo #
--echo # Bug#13052 mysqldump timestamp reloads broken
--echo #

--disable_warnings
drop table if exists t1;
--enable_warnings

create table t1 (`d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, unique (`d`));
set time_zone='+00:00';
insert into t1 values ('2003-10-25 22:00:00'),('2003-10-25 23:00:00');
# results should show two different time values
select * from t1;
set time_zone='Europe/Moscow';
# results should show two same time values, despite unique
select * from t1;
set global time_zone='Europe/Moscow';
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-tz-utc --skip-comments --databases test
drop table t1;
set global time_zone=default;
set time_zone=default;

--echo #
--echo # Test of fix to Bug#13146 ansi quotes break loading of triggers
--echo #

--disable_warnings
DROP TABLE IF EXISTS `t1 test`;
DROP TABLE IF EXISTS `t2 test`;
--enable_warnings

CREATE TABLE `t1 test` (
  `a1` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE `t2 test` (
  `a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DELIMITER //;
CREATE TRIGGER `test trig` BEFORE INSERT ON `t1 test` FOR EACH ROW BEGIN
INSERT INTO `t2 test` SET a2 = NEW.a1; END  //
DELIMITER ;//

INSERT INTO `t1 test` VALUES (1);
INSERT INTO `t1 test` VALUES (2);
INSERT INTO `t1 test` VALUES (3);
SELECT * FROM `t2 test`;
# dump with compatible=ansi. Everything except triggers should be double
# quoted
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --compatible=ansi --triggers test

DROP TRIGGER `test trig`;
DROP TABLE `t1 test`;
DROP TABLE `t2 test`;

--echo #
--echo # Bug#12838 mysqldump -x with views exits with error
--echo #

--disable_warnings
drop table if exists t1;
--enable_warnings
create table t1 (a int, b varchar(32), c varchar(32));
insert into t1 values (1, 'first value', 'xxxx');
insert into t1 values (2, 'second value', 'tttt');
insert into t1 values (3, 'third value', 'vvv vvv');

create view v1 as select * from t1;
create view v0 as select * from v1;
create view v2 as select * from v0;

select * from v2;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 -x --skip-comments --databases test

drop view v2;
drop view v0;
drop view v1;
drop table t1;

--echo #
--echo # Bug#14554 mysqldump does not separate words "ROW" and "BEGIN"
--echo # for tables with trigger created in the IGNORE_SPACE sql mode.
--echo #

SET @old_sql_mode = @@SQL_MODE;
SET SQL_MODE = IGNORE_SPACE;

CREATE TABLE t1 (a INT);
DELIMITER |;
CREATE TRIGGER tr1 BEFORE INSERT ON t1
       FOR EACH ROW
       BEGIN
         SET new.a = 0;
       END|
DELIMITER ;|

SET SQL_MODE = @old_sql_mode;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --databases test

DROP TRIGGER tr1;
DROP TABLE t1;

--echo #
--echo # Bug#13318 Bad result with empty field and --hex-blob
--echo #

create table t1 (a binary(1), b blob);
insert into t1 values ('','');
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --skip-extended-insert --hex-blob test t1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --hex-blob test t1
drop table t1;

--echo #
--echo # Bug#14871 Invalid view dump output
--echo #

create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
create SQL SECURITY INVOKER view v2 as select * from t1;
create view v3 as select * from t1 with local check option;
create algorithm=merge view v4 as select * from t1 with cascaded check option;
create algorithm =temptable view v5 as select * from t1;

# dump tables and views
--exec $MYSQL_DUMP --default-character-set=utf8mb4 test > $MYSQLTEST_VARDIR/tmp/bug14871.sql

# drop the db, tables and views
drop table t1;
drop view v1, v2, v3, v4, v5;

# Reload dump
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug14871.sql

# check that all tables and views could be created
show tables;
select * from v3 order by a;

drop table t1;
drop view v1, v2, v3, v4, v5;
--remove_file $MYSQLTEST_VARDIR/tmp/bug14871.sql


--echo #
--echo # Bug#16878 dump of trigger
--echo #

create table t1 (a int, created datetime);
create table t2 (b int, created datetime);
create trigger tr1 before insert on t1 for each row set
new.created=now();
delimiter |;
create trigger tr2 after insert on t1
for each row
begin
  insert into t2 set b=new.a and created=new.created;
end|
delimiter ;|

# dump table and trigger
--exec $MYSQL_DUMP --default-character-set=utf8mb4 test > $MYSQLTEST_VARDIR/tmp/bug16878.sql
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;

# reload dump
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug16878.sql
--replace_column 6 #
show triggers;
drop trigger tr1;
drop trigger tr2;
drop table t1, t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug16878.sql


--echo #
--echo # Bug#18462 mysqldump does not dump view structures correctly
--echo #

create table t (qty int, price int);
insert into t values(3, 50);
insert into t values(5, 51);
create view v1 as select qty, price, qty*price as value from t;
create view v2 as select qty from v1;
--echo mysqldump {
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact -F --tab $MYSQLTEST_VARDIR/tmp test
--cat_file $MYSQLTEST_VARDIR/tmp/v1.sql
--echo } mysqldump {
--cat_file $MYSQLTEST_VARDIR/tmp/v2.sql
--echo } mysqldump
drop view v1;
drop view v2;
drop table t;
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/v2.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t.txt


--echo #
--echo # Bug#14857 Reading dump files with single statement stored routines fails.
--echo # fixed by patch for Bug#16878
--echo #

DELIMITER |;
/*!50003 CREATE FUNCTION `f`() RETURNS bigint(20)
return 42 */|
/*!50003 CREATE PROCEDURE `p`()
select 42 */|
DELIMITER ;|
show create function f;
show create procedure p;
drop function f;
drop procedure p;

--echo #
--echo # Bug#17371 Unable to dump a schema with invalid views
--echo #

create table t1 ( id serial );
create view v1 as select * from t1;
drop table t1;
# mysqldump gets 1356 from server, but gives us 2
--echo mysqldump {
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --force -N --compact --skip-comments test 2>&1
--echo } mysqldump
drop view v1;


--echo # Bug#17201 Spurious 'DROP DATABASE' in output,
--echo # also confusion between tables and views.
--echo # Example code from Markus Popp

create database mysqldump_test_db;
use mysqldump_test_db;
create table t1 (id int);
create view v1 as select * from t1;
insert into t1 values (1232131);
insert into t1 values (4711);
insert into t1 values (3231);
insert into t1 values (0815);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --add-drop-database --databases mysqldump_test_db
drop view v1;
drop table t1;
drop database mysqldump_test_db;


--echo #
--echo # Bug#21014 Segmentation fault of mysqldump on view
--echo #

create database mysqldump_tables;
use mysqldump_tables;
create table basetable ( id serial, tag varchar(64) );

create database mysqldump_views;
use mysqldump_views;
create view nasishnasifu as select mysqldump_tables.basetable.id from mysqldump_tables.basetable;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --compact --databases mysqldump_tables mysqldump_views

drop view nasishnasifu;
drop database mysqldump_views;
drop table mysqldump_tables.basetable;
drop database mysqldump_tables;

--echo #
--echo # Bug#20221 Dumping of multiple databases containing view(s) yields maleformed dumps
--echo #

create database mysqldump_dba;
use mysqldump_dba;
create table t1 (f1 int, f2 int);
insert into t1 values (1,1);
create view v1 as select f1, f2 from t1;

create database mysqldump_dbb;
use mysqldump_dbb;
create table t1 (f1 int, f2 int);
insert into t1 values (2,2);
create view v1 as select f1, f2 from t1;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --add-drop-database --databases mysqldump_dba mysqldump_dbb > $MYSQLTEST_VARDIR/tmp/bug20221_backup

drop view v1;
drop table t1;
drop database mysqldump_dbb;
use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;

--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20221_backup

select * from mysqldump_dba.v1;
select * from mysqldump_dbb.v1;

use mysqldump_dba;
drop view v1;
drop table t1;
drop database mysqldump_dba;
use mysqldump_dbb;
drop view v1;
drop table t1;
drop database mysqldump_dbb;
--remove_file $MYSQLTEST_VARDIR/tmp/bug20221_backup
use test;

--echo #
--echo # Bug#21215 mysqldump creating incomplete backups without warning
--echo #

# Create user without sufficient privs to perform the requested operation
create user mysqltest_1@localhost;
grant all on test.* to  mysqltest_1@localhost;
create table t1(a int, b varchar(34));

# To get consistent output, reset the master, starts over from first log
reset master;

# Execute mysqldump, will fail on FLUSH TABLES
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --master-data -u mysqltest_1 test 2>&1

# Execute mysqldump, will fail on FLUSH TABLES
# use --force, should no affect behaviour
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --force --master-data -u mysqltest_1 test 2>&1

# Add RELOAD grants
grant RELOAD on *.* to mysqltest_1@localhost;

# Execute mysqldump, will fail on SHOW MASTER STATUS
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --master-data -u mysqltest_1 test 2>&1

# Execute mysqldump, will fail on SHOW MASTER STATUS.
# use --force, should not alter behaviour
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --force --master-data -u mysqltest_1 test 2>&1

# Add REPLICATION CLIENT grants
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;

# Execute mysqldump, should now succeed
--disable_result_log
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --master-data -u mysqltest_1 test 2>&1
--enable_result_log

# Clean up
drop table t1;
drop user mysqltest_1@localhost;


--echo #
--echo # Bug#21424 mysqldump failing to export/import views
--echo #

# Do as root
connect (root,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
connection root;
create database mysqldump_myDB;
use mysqldump_myDB;
create user myDB_User@localhost;
grant create, create view, select, insert on mysqldump_myDB.* to myDB_User@localhost;
create table t1 (c1 int);
insert into t1 values (3);

# Do as a user
connect (user1,localhost,myDB_User,,mysqldump_myDB,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user1;
use mysqldump_myDB;
create table u1 (f1 int);
insert into u1 values (4);
create view v1 (c1) as select * from t1;

# Backup should not fail for Bug#21527. Flush priviliges test begins.
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --add-drop-table --flush-privileges --ignore-table=mysql.general_log --ignore-table=mysql.slow_log --ignore-table=mysql.transaction_registry --databases mysqldump_myDB mysql > $MYSQLTEST_VARDIR/tmp/bug21527.sql

# Clean up
connection root;
use mysqldump_myDB;
drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
flush privileges;


--echo # Bug#21424 continues from here.
--echo # Restore. Flush Privileges test ends.
--echo #

--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug21527.sql

# Do as a user
connection user1;
use mysqldump_myDB;

# Ultimate test for correct data.
select * from mysqldump_myDB.v1;
select * from mysqldump_myDB.u1;

# Final cleanup.
connection root;
disconnect user1;
use mysqldump_myDB;
drop view v1;
drop table t1;
drop table u1;
revoke all privileges on mysqldump_myDB.* from myDB_User@localhost;
drop user myDB_User@localhost;
drop database mysqldump_myDB;
connection default;
disconnect root;
--remove_file $MYSQLTEST_VARDIR/tmp/bug21527.sql
use test;

--echo #
--echo # Bug #21527 mysqldump incorrectly tries to LOCK TABLES on the 
--echo # information_schema database.
--echo #
--echo # Bug #33762: mysqldump can not dump INFORMATION_SCHEMA
--echo #
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compact --opt -d information_schema TABLES

--echo #
--echo # Bug#19745 mysqldump --xml produces invalid xml
--echo #

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (f1 int(10), data MEDIUMBLOB);
INSERT INTO t1 VALUES(1,0xff00fef0);

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --xml --hex-blob --skip-create-options test t1

DROP TABLE t1;


--echo #
--echo # Bug#26346 stack + buffer overrun in mysqldump
--echo #

CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2);

# too long a file path causes an error
--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test

--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt

DROP TABLE t1;

#
# Bug #25993 crashes with a merge table and -c
#

CREATE TABLE t2 (a INT) ENGINE=MyISAM;
CREATE TABLE t3 (a INT) ENGINE=MyISAM;
CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments -c test
DROP TABLE t1, t2, t3;


--echo #
--echo # Bug#23491 MySQLDump prefix function call in a view by database name
--echo #

# Setup
create database bug23491_original;
create database bug23491_restore;
use bug23491_original;
create table t1 (c1 int);
create view v1 as select * from t1;
create procedure p1() select 1;
create function f1() returns int return 1;
create view v2 as select f1();
create function f2() returns int return f1();
create view v3 as select bug23491_original.f1();

# Backup.
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments -uroot --opt --routines bug23491_original > $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql

# Restore.
--exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql

# Verify
use bug23491_restore;
show create view bug23491_restore.v2;
show create view bug23491_restore.v3;

# Cleanup
drop database bug23491_original;
drop database bug23491_restore;
use test;
--remove_file $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql



--echo #
--echo # Bug#27293 mysqldump crashes when dumping routines
--echo #           defined by a different user
--echo #
--echo # Bug#22761 mysqldump reports no errors when using
--echo #           --routines without mysql.proc privileges
--echo #

create database mysqldump_test_db;

grant all privileges on mysqldump_test_db.*  to user1;
grant all privileges on mysqldump_test_db.*  to user2;
revoke SHOW CREATE ROUTINE on  mysqldump_test_db.* from user1;
revoke SHOW CREATE ROUTINE on  mysqldump_test_db.* from user2;

connect (user27293,localhost,user1,,mysqldump_test_db,$MASTER_MYPORT,$MASTER_MYSOCK);
connection user27293;

create procedure mysqldump_test_db.sp1() select 'hello';

--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP -f --compact --user=user2 --password=  -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db 2>&1

--exec $MYSQL_DUMP -f --compact --user=user1 --password=  -h 127.0.0.1 -P $MASTER_MYPORT --routines mysqldump_test_db

drop procedure sp1;

connection default;
disconnect user27293;
drop user user1;
drop user user2;

drop database mysqldump_test_db;

--echo #
--echo # Bug#28522 buffer overrun by '\0' byte using --hex-blob.
--echo #

CREATE TABLE t1 (c1 INT, c2 LONGBLOB);
INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
--exec $MYSQL_DUMP --skip-create-options --compact --hex-blob test t1
DROP TABLE t1;

--echo #
--echo # Bug#28524 mysqldump --skip-add-drop-table is not
--echo #           compatible with views
--echo #

CREATE VIEW v1 AS SELECT 1;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-add-drop-table test > $MYSQLTEST_VARDIR/tmp/bug28524.sql
DROP VIEW v1;

--exec $MYSQL test <  $MYSQLTEST_VARDIR/tmp/bug28524.sql
SELECT * FROM v1;
DROP VIEW v1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug28524.sql


--echo #
--echo # Bug#29788 mysqldump discards the NO_AUTO_VALUE_ON_ZERO value of
--echo #           the SQL_MODE variable after the dumping of triggers.
--echo #

CREATE TABLE t1 (c1 INT);
CREATE TRIGGER t1bd BEFORE DELETE ON t1 FOR EACH ROW BEGIN END;

CREATE TABLE t2 (c1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);

SET @TMP_SQL_MODE = @@SQL_MODE;
SET SQL_MODE = 'NO_AUTO_VALUE_ON_ZERO';
INSERT INTO t2 VALUES (0), (1), (2);
SET SQL_MODE = @TMP_SQL_MODE;
SELECT * FROM t2;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --routines test >$MYSQLTEST_VARDIR/tmp/bug29788.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug29788.sql
SELECT * FROM t2;

DROP TABLE t1,t2;
--remove_file $MYSQLTEST_VARDIR/tmp/bug29788.sql


--echo #
--echo # Bug#29815 new option for suppressing last line of mysqldump:
--echo #           "Dump completed on"
--echo #

--echo # --skip-dump-date:
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*//
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-dump-date test

--echo # --dump-date:
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --dump-date test

--echo # --dump-date (default):
--replace_regex /-- [^D][^u][^m][^p].*// /\/\*!.*// / on [0-9 :-]+/ on DATE/
--exec $MYSQL_DUMP --default-character-set=utf8mb4 test

--echo #
--echo # Bug #42635: mysqldump includes views that were excluded using 
--echo #   the --ignore-table option
--echo #

create database db42635;
use db42635;
create table t1 (id int);
create view db42635.v1 (c) as select * from db42635.t1;
create view db42635.v2 (c) as select * from db42635.t1;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --ignore-table=db42635.v1 db42635
use test;
drop database db42635;

--echo #
--echo # Bug#33550 mysqldump 4.0 compatibility broken
--echo #

SET NAMES utf8;
CREATE TABLE `straße` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test
DROP TABLE `straße`;

CREATE TABLE `כדשגכחךלדגכחשךדגחכךלדגכ` ( f1 INT );
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=utf8 --compatible=mysql323 test
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --skip-comments --default-character-set=latin1 --compatible=mysql323 test 2>&1
DROP TABLE `כדשגכחךלדגכחשךדגחכךלדגכ`;
SET NAMES latin1;

--echo #
--echo # End of 5.0 tests
--echo #

# Check new --replace option

--disable_warnings
drop table if exists t1;
--enable_warnings

CREATE TABLE t1(a int, b int);
INSERT INTO t1 VALUES (1,1);
INSERT INTO t1 VALUES (2,3);
INSERT INTO t1 VALUES (3,4), (4,5);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --replace --skip-comments test t1
DROP TABLE t1;

#
# Added for use-thread option
#

create table t1 (a text , b text);
create table t2 (a text , b text);
insert t1 values ("Duck, Duck", "goose");
insert t1 values ("Duck, Duck", "pidgeon");
insert t2 values ("We the people", "in order to perform");
insert t2 values ("a more perfect", "union");
select * from t1;
select * from t2;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ test
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t2.sql
# The first load tests the pausing code
--exec $MYSQL_IMPORT --use-threads=1 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
# Now we test with multiple threads!
--exec $MYSQL_IMPORT --silent --use-threads=5 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt
select * from t1;
select * from t2;
# Now we test with multiple threads, but less threads than files.
create table words(a varchar(255));
create table words2(b varchar(255));
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat
select * from t1;
select * from t2;
select * from words;
select * from words2;

# Drop table "words" and run with threads, should fail
drop table words;
--replace_regex /.*mariadb-import(\.exe)*/mariadb-import/
--error 1
--exec $MYSQL_IMPORT --silent --use-threads=2 test $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt $MYSQLTEST_VARDIR/std_data/words.dat $MYSQLTEST_VARDIR/std_data/words2.dat 2>&1

drop table t1;
drop table t2;

drop table words2;

--echo #
--echo # Bug#16853 mysqldump doesn't show events
--echo #

create database first;
use first;
set time_zone = 'UTC';

## prove one works (with spaces and tabs on the end)
create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5;    	 	
show events;
show create event ee1;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --events first > $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
drop database first;

create database second;
use second;
--exec $MYSQL second < $MYSQLTEST_VARDIR/tmp/bug16853-1.sql
show events;
show create event ee1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug16853-1.sql

## prove three works (with spaces and tabs on the end)
# start with one from the previous restore
create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5;	      
create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5;    		
show events;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
drop database second;

create database third;
use third;
--exec $MYSQL third < $MYSQLTEST_VARDIR/tmp/bug16853-2.sql
show events;
drop database third;
--remove_file $MYSQLTEST_VARDIR/tmp/bug16853-2.sql

# revert back to normal settings
set time_zone = 'SYSTEM';
use test;

--echo #
--echo # Bug#17201 Spurious 'DROP DATABASE' in output,
--echo # also confusion between tables and views.
--echo # Example code from Markus Popp
--echo #

create database mysqldump_test_db;
use mysqldump_test_db;
create table t1 (id int);
create view v1 as select * from t1;
insert into t1 values (1232131);
insert into t1 values (4711);
insert into t1 values (3231);
insert into t1 values (0815);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --add-drop-database --databases mysqldump_test_db
drop view v1;
drop table t1;
drop database mysqldump_test_db;

#
# Bug#26121 mysqldump includes LOCK TABLES general_log WRITE
#
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --all-databases > $MYSQLTEST_VARDIR/tmp/bug26121.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug26121.sql
--remove_file $MYSQLTEST_VARDIR/tmp/bug26121.sql

###########################################################################

--echo #
--echo # Bug#30027 mysqldump does not dump views properly.
--echo #

--echo
--echo # Cleanup.

--disable_warnings
DROP DATABASE IF EXISTS mysqldump_test_db;
--enable_warnings

--echo
--echo # Create objects.

CREATE DATABASE mysqldump_test_db;

set names koi8r;

CREATE VIEW mysqldump_test_db.v2 AS SELECT 1 AS �������1;
CREATE VIEW mysqldump_test_db.v1 AS SELECT �������1 FROM mysqldump_test_db.v2;

set names latin1;

--echo
--echo # Dump mysqldump_test_db to bug30027.sql.

--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=latin1 --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30027.sql

--echo
--echo # Drop mysqldump_test_db.

DROP DATABASE mysqldump_test_db;

--echo
--echo # Restore mysqldump_test_db from bug30027.sql.

--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30027.sql

--echo
--echo # Check the view.

set names utf8;

SHOW CREATE VIEW mysqldump_test_db.v1;
SHOW CREATE VIEW mysqldump_test_db.v2;

set names latin1;

--echo
--echo # Cleanup.

DROP DATABASE mysqldump_test_db;
--remove_file $MYSQLTEST_VARDIR/tmp/bug30027.sql

###########################################################################

--echo #
--echo # Bug#29938 wrong behavior of mysqldump --skip-events
--echo #           with --all-databases
--echo #

TRUNCATE mysql.event;

USE test;
CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938;
SHOW EVENTS;
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-events --all-databases > $MYSQLTEST_VARDIR/tmp/bug29938.sql

TRUNCATE mysql.event;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29938.sql
SHOW EVENTS;
--remove_file $MYSQLTEST_VARDIR/tmp/bug29938.sql

--echo #
--echo # MDEV-13336: add ignore-database option
--echo #           with --all-databases
--echo #
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
SET GLOBAL innodb_max_purge_lag_wait=0;
DROP DATABASE test;
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
SHOW DATABASES LIKE 'test';
CREATE DATABASE test;

--echo #
--echo # Bug#31113 mysqldump 5.1 can't handle a dash ("-") in database names
--echo #
create database `test-database`;
use `test-database`;
create table test (a int);
--exec $MYSQL_DUMP --compact --opt --quote-names test-database
drop database `test-database`;
use test;

###########################################################################

--echo
--echo # -----------------------------------------------------------------
--echo # -- Bug#30217 Views: changes in metadata behaviour between 5.0 and 5.1.
--echo # -----------------------------------------------------------------
--echo

--disable_warnings
DROP DATABASE IF EXISTS mysqldump_test_db;
--enable_warnings

CREATE DATABASE mysqldump_test_db;
use mysqldump_test_db;

--echo

CREATE VIEW v1(x, y) AS SELECT 'a', 'a';

--echo

SELECT view_definition
FROM INFORMATION_SCHEMA.VIEWS
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';

--echo

--echo ---> Dumping mysqldump_test_db to bug30217.sql
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --character-sets-dir=$MYSQL_SHAREDIR/charsets --databases mysqldump_test_db > $MYSQLTEST_VARDIR/tmp/bug30217.sql

--echo

DROP DATABASE mysqldump_test_db;
use test;

--echo

--echo ---> Restoring mysqldump_test_db...
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug30217.sql

--echo

SELECT view_definition
FROM INFORMATION_SCHEMA.VIEWS
WHERE table_schema = 'mysqldump_test_db' AND table_name = 'v1';

--echo

DROP DATABASE mysqldump_test_db;
--remove_file $MYSQLTEST_VARDIR/tmp/bug30217.sql

--echo
--echo # -- End of test case for Bug#32538.
--echo

--echo #
--echo # Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
--echo #

create table t1 (a int);
create view v1 as select a from t1;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test t1 v1

drop view v1;
drop table t1;

--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/v1.sql

drop view v1;
drop table t1;

--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql


--echo #
--echo # Bug#28071 mysqlimport does not quote or escape table name
--echo #

--disable_warnings
drop table if exists `load`;
--enable_warnings
create table `load` (a varchar(255));

--copy_file std_data/words.dat $MYSQLTEST_VARDIR/tmp/load.txt
# LOAD DATA requires the file to be world-readable. This may not be true
# automatically, depending on how the build directory was created.
--chmod 0644 $MYSQLTEST_VARDIR/tmp/load.txt

--exec $MYSQL_IMPORT --ignore test $MYSQLTEST_VARDIR/tmp/load.txt

select count(*) from `load`;

--remove_file $MYSQLTEST_VARDIR/tmp/load.txt

drop table `load`;

# We reset concurrent_inserts value to whatever it was at the start of the
# test This line must be executed _after_ all test cases.
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;


###########################################################################

--echo
--echo Bug #34861 - mysqldump with --tab gives weird output for triggers.
--echo

CREATE TABLE t1 (f1 INT);
CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1;
CREATE PROCEDURE pr1 () SELECT "Meow";
CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow";

--echo
--replace_column 6 #
SHOW TRIGGERS;
SHOW EVENTS;
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';

--echo
--echo dump table; if anything goes to stdout, it ends up here: ---------------
--exec $MYSQL_DUMP --compact --routines --triggers --events --result-file=$MYSQLTEST_VARDIR/tmp/test_34861.sql --tab=$MYSQLTEST_VARDIR/tmp/ test

--echo
--echo drop everything
DROP EVENT ev1;
DROP TRIGGER tr1;
DROP TABLE t1;
DROP PROCEDURE pr1;

--echo
--echo reload table; this should restore table and trigger
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--replace_column 6 #
SHOW TRIGGERS;
SHOW EVENTS;
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';

--echo
--echo reload db; this should restore routines and events
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/test_34861.sql
--replace_column 6 #
SHOW TRIGGERS;
SHOW EVENTS;
SELECT name,body FROM mysql.proc WHERE NAME = 'pr1';

--echo
--echo cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/test_34861.sql
--disable_warnings
DROP EVENT IF EXISTS ev1;
DROP PROCEDURE IF EXISTS pr1;
DROP TRIGGER IF EXISTS tr1;
DROP TABLE IF EXISTS t1;
--enable_warnings

###########################################################################

--echo #
--echo # Bug #30946: mysqldump silently ignores --default-character-set
--echo #             when used with --tab
--echo #
--echo # Also see outfile_loaddata.test
--echo #

SET NAMES utf8;
CREATE TABLE t1 (a INT, b CHAR(10) CHARSET koi8r, c CHAR(10) CHARSET latin1);
CREATE TABLE t2 LIKE t1;
INSERT INTO t1 VALUES (1, 'ABC-АБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL);

--let $file=$MYSQLTEST_VARDIR/tmp/t1.txt


--echo # error on multi-character ENCLOSED/ESCAPED BY

--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by='12345' test t1 2>&1
--remove_file $file

--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --disable-default-character-set --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by='12345' test t1 2>&1
--remove_file $file

--echo # default '--default-charset' (binary):

--exec $MYSQL_DUMP --disable-default-character-set --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;


--echo # utf8:

--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=utf8 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET utf8
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;


--echo # latin1 (data corruption is expected):

--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=latin1 --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1 
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;


--echo # koi8r (data corruption is expected):

--exec $MYSQL_DUMP --character-sets-dir=$MYSQL_SHAREDIR/charsets --default-character-set=koi8r --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
TRUNCATE t2;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
--remove_file $file
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;


SET NAMES default;

DROP TABLE t1, t2;
###########################################################################

--echo #
--echo # Bug #53088: mysqldump with -T & --default-character-set set
--echo #             truncates text/blob to 766 chars
--echo #
--echo # Also see outfile_loaddata.test
--echo #

CREATE TABLE t1 (a BLOB) CHARSET latin1;
CREATE TABLE t2 LIKE t1;

let $table= t1;
let $dir= $MYSQLTEST_VARDIR/tmp;
let $file= $dir/$table.txt;
let $length= 800;

--eval INSERT INTO t1 VALUES (REPEAT('.', $length))

--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$dir/ test $table
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR

--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
--remove_file $file

--echo # should be $length
SELECT LENGTH(a) FROM t2;

DROP TABLE t1, t2;

###########################################################################

--echo #
--echo # Bug #13618 : mysqldump --xml ommit comment on table field
--echo #

CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE COMMENT';
--exec $MYSQL_DUMP --compact --skip-create-options --xml test
DROP TABLE `comment_table`;

--echo #
--echo # BUG#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN
--echo #                DATABASE NAMES IN ALTER DATABASE
--echo #

CREATE DATABASE `test-database`;
USE `test-database`;
CREATE TABLE `test` (`c1` VARCHAR(10)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

DELIMITER |;
CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN
END |
DELIMITER ;|

ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci;
ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ;

--exec $MYSQL_DUMP --quote-names --compact test-database

DROP DATABASE `test-database`;
# Switching back to test database.
USE test;

--echo #
--echo # BUG#11760384 : 52792: mysqldump in XML mode does not dump routines.
--echo #
CREATE DATABASE BUG52792;
USE BUG52792;
CREATE TABLE t1 (c1 INT, c2 VARCHAR(20));
CREATE TABLE t2 (c1 INT);
INSERT INTO t1 VALUES (1, 'aaa'), (2, 'bbb'), (3, 'ccc');
INSERT INTO t2 VALUES (1),(2),(3);

--echo # Stored Procedures.

DELIMITER //;
CREATE PROCEDURE simpleproc1 (OUT param1 INT)
BEGIN
  SELECT COUNT(*) INTO param1 FROM t1;
END//
DELIMITER ;//

DELIMITER //;
CREATE PROCEDURE simpleproc2 (OUT param1 INT)
BEGIN
  SELECT COUNT(*) INTO param1 FROM t2;
END//
DELIMITER ;//

--echo # Events.

CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;
CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792;

--echo # Functions.

CREATE FUNCTION `hello1` (s CHAR(20))
  RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT('Hello, ' ,s ,'!');

CREATE FUNCTION `hello2` (s CHAR(20))
    RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ' , s ,'!');

--echo # Triggers.

DELIMITER |;
CREATE TRIGGER trig1 BEFORE INSERT ON t2
  FOR EACH ROW BEGIN
    INSERT INTO t2 VALUES(1);
END;
|
DELIMITER ;|

DELIMITER |;
CREATE TRIGGER trig2 AFTER INSERT ON t2
  FOR EACH ROW BEGIN
    INSERT INTO t2 VALUES(1, ']]>');
    INSERT INTO t2 VALUES(2, '<![CDATA]]>');
    INSERT INTO t2 VALUES(3, '<![CDATA[');
    INSERT INTO t2 VALUES(4, '< > & \ " _');
END;
|
DELIMITER ;|

--echo # Views

CREATE VIEW v1 AS SELECT * FROM t1;
CREATE VIEW v2 AS SELECT * FROM t2;
--echo
--echo # Dumping BUG52792 database in xml format.
--echo
--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
--exec $MYSQL_DUMP --user=root --compact -R -E --triggers -X BUG52792
--echo
--echo # Dumping BUG52792 database in xml format with comments.
--echo
--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
--exec $MYSQL_DUMP --comments --user=root -R -E --triggers -X BUG52792

--echo
--echo # Test to check 'Insufficient privileges' error.
--echo

GRANT ALL PRIVILEGES ON BUG52792.* TO user1;
REVOKE SHOW CREATE ROUTINE ON BUG52792.* FROM user1;

connect (conn_1, localhost, user1, , BUG52792, $MASTER_MYPORT, $MASTER_MYSOCK);
connection conn_1;

--echo # Running 'replace_regex on timestamp'
--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/

--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --user=user1 -R -E --triggers -X BUG52792 2>&1

connection default;
disconnect conn_1;

DROP USER user1;
DROP DATABASE BUG52792;
--echo # UTF-8
CREATE DATABASE BUG52792;
USE BUG52792;
SET NAMES utf8;
CREATE FUNCTION `straße` ( c1 CHAR(20))
  RETURNS CHAR(50) DETERMINISTIC
RETURN CONCAT(']]>, ', c1, '!');

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --character-sets-dir=$CHARSETSDIR --skip-comments --default-character-set=utf8 --compatible=mysql323 -R -X BUG52792

DROP DATABASE BUG52792;

USE test;

--echo #
--echo # End of 5.1 tests
--echo #

--echo #
--echo # Verify that two modes can be given in --compatible;
--echo # and are reflected in SET SQL_MODE in the mysqldump output.
--echo # Also verify that a prefix of the mode's name is enough.
--echo #
CREATE TABLE t1 (a INT);
# no_t = no_table_options; no_f = no_field_options
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --compatible=no_t,no_f --skip-comments test
DROP TABLE t1;

--echo #
--echo # Bug#12809202 61854: MYSQLDUMP --SINGLE-TRANSACTION --FLUSH-LOG BREAKS
--echo #                     CONSISTENCY
--echo #

--disable_warnings
DROP DATABASE IF EXISTS b12809202_db;
--enable_warnings

CREATE DATABASE b12809202_db;
CREATE TABLE b12809202_db.t1 (c1 INT);
CREATE TABLE b12809202_db.t2 (c1 INT);

INSERT INTO b12809202_db.t1 VALUES (1), (2), (3);
INSERT INTO b12809202_db.t2 VALUES (1), (2), (3);

--echo # Starting mysqldump with --single-transaction & --flush-logs options..
--echo # Note : In the following dump the transaction
--echo #        should start only after the logs are
--echo #        flushed, as 'flush logs' causes implicit
--echo #        commit starting 5.5.
--echo
--echo #### Dump starts here ####
# We only need to check the --verbose output to verify that "start transaction"
# happens after "logs flushed". We redirect normal output, as otherwise the
# mixing of normal (stdout) and --verbose (stderr) output will happen in random
# order depending on stdio internal buffer size.
--replace_regex /-- Server version.*// /-- MySQL dump .*// /-- Dump completed on .*/-- Dump completed/
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --verbose --single-transaction --flush-logs b12809202_db 2>&1 > $MYSQLTEST_VARDIR/tmp/bug61854.sql
--echo
--echo #### Dump ends here ####

# Cleanup
DROP TABLE b12809202_db.t1;
DROP TABLE b12809202_db.t2;
DROP DATABASE b12809202_db;

--echo #
--echo # Delete all existing binary logs.
--echo #
RESET MASTER;

# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

--echo #
--echo # Bug#45740 MYSQLDUMP DOESN'T DUMP GENERAL_LOG AND SLOW_QUERY CAUSES RESTORE PROBLEM
--echo #
SET @old_log_output_state=       @@global.log_output;
SET @old_general_log_state=      @@global.general_log;
SET @old_slow_query_log_state=   @@global.slow_query_log;

call mtr.add_suppression("Failed to write to mysql.general_log");
--exec $MYSQL_DUMP --default-character-set=utf8mb4 -uroot --all-databases > $MYSQLTEST_VARDIR/tmp/bug45740.sql
# Make log_output as table and disabling general_log and slow_log
SET @@global.log_output="TABLE";
SET @@global.general_log='OFF';
SET @@global.slow_query_log='OFF';
DROP DATABASE mysql; 
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug45740.sql
SHOW CREATE TABLE mysql.general_log;
SHOW CREATE TABLE mysql.slow_log;
--remove_file $MYSQLTEST_VARDIR/tmp/bug45740.sql

SET @@global.log_output=       @old_log_output_state;
SET @@global.slow_query_log=   @old_slow_query_log_state;
SET @@global.general_log=      @old_general_log_state;
 
--echo # MDEV-5481 mysqldump fails to dump geometry types properly

create table t1 (g GEOMETRY) CHARSET koi8r;
create table t2 (g GEOMETRY) CHARSET koi8r;
insert into t1 values (point(1,1)), (point(2,2));
--exec $MYSQL_DUMP --disable-default-character-set --hex-blob --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--echo ##################################################
--cat_file $file
--echo ##################################################
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET koi8r
--remove_file $file
select astext(g) from t2;
drop table t1, t2;

--echo #
--echo # End of 5.1 tests
--echo #

--echo #
--echo # Bug #20772273 : MYSQLIMPORT --USE-THREADS DOESN'T USE MULTIPLE THREADS
--echo #

CREATE DATABASE db_20772273;
USE db_20772273;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2(a INT);
INSERT INTO t2 VALUES (3), (4);

SELECT * FROM t1;
SELECT * FROM t2;

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --tab=$MYSQLTEST_VARDIR/tmp/ --parallel=2 db_20772273
--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL db_20772273 < $MYSQLTEST_VARDIR/tmp/t2.sql

# Test mysqlimport with multiple threads
--exec $MYSQL_IMPORT --silent --parallel=2 db_20772273 $MYSQLTEST_VARDIR/tmp/t1.txt $MYSQLTEST_VARDIR/tmp/t2.txt

SELECT * FROM t1;
SELECT * FROM t2;

#Cleanup
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
USE test;
--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt

--echo #
--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
--echo #


CREATE DATABASE bug25717383;
use bug25717383;

CREATE TABLE `tab
one` (a int);
CREATE VIEW `view
one` as SELECT * FROM `tab
one`;

CREATE PROCEDURE `proc
one`() SELECT * from `tab
one`;

CREATE TEMPORARY TABLE `temp
one` (id INT);

CREATE TRIGGER `trig
one` BEFORE INSERT ON `tab
one` FOR EACH ROW SET NEW.a = 1;

CREATE EVENT `event
one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;

SHOW TABLES FROM bug25717383;
--replace_column 6 #
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;

SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
       WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
       ORDER BY ROUTINE_NAME;

--replace_result mariadb-dump.exe mariadb-dump
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql

SHOW TABLES FROM bug25717383;
--replace_column 6 #
SHOW TRIGGERS FROM bug25717383;
--replace_column 6 #
SHOW EVENTS FROM bug25717383;

SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
       WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
       ORDER BY ROUTINE_NAME;

DROP DATABASE bug25717383;

#
# MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
#
--replace_regex /mariadb-dump\.exe/mariadb-dump/ /'unknownhost' \(.*\)/'unknownhost'/
--error 2
--exec $MYSQL_DUMP --default-character-set=utf8mb4 -hunknownhost --dump-slave nulldb 2>&1

#
# MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested
#
--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --user=foo 2>&1
--exec $MYSQL_DUMP --help 2>&1 > $MYSQLTEST_VARDIR/tmp/bug6056.out

--echo #
--echo # MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
--echo #
CREATE DATABASE `a\"'``b`;
USE `a\"'``b`;
CREATE PROCEDURE p1() BEGIN END;
ALTER DATABASE `a\"'``b` COLLATE utf8_general_ci;
--let shell_ready_db_name="a\\\\\\"'`b"
if (`select convert(@@version_compile_os using latin1) IN ("Win32","Win64","Windows") = 0`)
{
  --let shell_ready_db_name=a\\\\\\"\\'\\`b
}
--exec $MYSQL_DUMP --routines --compact $shell_ready_db_name
DROP DATABASE `a\"'``b`;

#"
use test;

--echo #
--echo # Test mysqldump with --disable-query-logs
--echo #

create table t1 (a int);
insert into t1 values (1);

--exec $MYSQL_DUMP --default-character-set=utf8mb4 --hex-blob --character-sets-dir=$MYSQL_SHAREDIR/charsets --tab=$MYSQLTEST_VARDIR/tmp/ test t1
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --disable-log-queries --skip-comments test t1 >$MYSQLTEST_VARDIR/tmp/mysqldump-test.out
drop table t1;

--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqldump-test.out
select * from t1;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqldump-test.out
#select * from mysql.user;
#checksum table mysql.user;

--echo #
--echo # MDEV-9124 mysqldump does not dump data if table name is same as view earlier on
--echo #

CREATE DATABASE db1 CHARSET=utf8;
CREATE DATABASE db2 CHARSET=utf8;
USE db2;
CREATE TABLE nonunique_table_name (i1 serial) ENGINE=MEMORY;
INSERT INTO nonunique_table_name VALUES (1),(2);
CREATE TABLE nonunique_table_view_name (i2 int) ENGINE=InnoDB;
INSERT INTO nonunique_table_view_name VALUES (3),(4);
use db1;
CREATE TABLE basetable (id smallint) ENGINE=MyISAM;
CREATE TABLE nonunique_table_name (i3 smallint) ENGINE=MERGE UNION (basetable) INSERT_METHOD=LAST;
INSERT INTO nonunique_table_name VALUES (5),(6);
CREATE VIEW nonunique_table_view_name AS SELECT 1;

--echo 
--echo ##################################################
--echo # --compact --databases db1 db2
--exec $MYSQL_DUMP --compact --databases db1 db2
--echo 
--echo ##################################################
--echo # --compact db2
--echo
--exec $MYSQL_DUMP --compact db2
--echo 
--echo ##################################################
--echo # --compact --delayed-insert --no-data-med=0 --databases db2 db1
--exec $MYSQL_DUMP --compact --delayed-insert --no-data-med=0 --databases db2 db1
--echo 

DROP DATABASE db1;
DROP DATABASE db2;

#"
# MDEV-11505 wrong databasename in mysqldump comment
#
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/bug11505.sql;
let SEARCH_PATTERN=Database: mysql;
exec $MYSQL_DUMP mysql func  > $SEARCH_FILE;
source include/search_pattern_in_file.inc;

--echo #
--echo # MDEV-15021: Fix the order in which routines are called
--echo #
use test;
CREATE FUNCTION f() RETURNS INT RETURN 1;
CREATE VIEW v1 AS SELECT f();

--echo # Running mysqldump -uroot test --routines --tables v1 > **vardir**/test.dmp
--exec $MYSQL_DUMP --default-character-set=utf8mb4 -uroot test --routines --tables v1 > $MYSQLTEST_VARDIR/test.dmp

DROP VIEW v1;
DROP FUNCTION f;

--echo # Running mysql -uroot test < **vardir**/test.dmp
--exec $MYSQL -uroot test < $MYSQLTEST_VARDIR/test.dmp

--echo #
--echo # Cleanup after succesful import.
--echo #
DROP VIEW v1;
DROP FUNCTION f;

--echo #
--echo # MDEV-788 New option to ignore foreign key contraints in mysqlimport
--echo #
create table t1 (
  id int primary key
) engine=InnoDB;

create table t2 (
  t1_id int,
  CONSTRAINT fk
    FOREIGN KEY (t1_id) REFERENCES t1 (id)
) ENGINE = InnoDB;

--write_file $MYSQLTEST_VARDIR/tmp/t2.txt
0
EOF

--replace_regex /.*mariadb-import(\.exe)*/mariadb-import/
--error 1
--exec $MYSQL_IMPORT --silent test $MYSQLTEST_VARDIR/tmp/t2.txt 2>&1
--exec $MYSQL_IMPORT --silent -k test $MYSQLTEST_VARDIR/tmp/t2.txt
select count(*) from t2;

--exec $MYSQL_IMPORT --silent --ignore-foreign-keys test $MYSQLTEST_VARDIR/tmp/t2.txt
select count(*) from t2;

--remove_file $MYSQLTEST_VARDIR/tmp/t2.txt
drop tables t2, t1;


--echo #
--echo # MDEV-22037: Add ability to skip content of some tables
--echo # (work around for MDEV-20939)
--echo #

create user a;
grant SELECT on test.* to  a;
use mysql;

--echo # check that all tables we need are not empty

select count(*) >=  1 from  mysql.proc;
select count(*) >=  1 from  mysql.db;


--exec $MYSQL_DUMP mysql --ignore-table-data=mysql.db >$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql


--echo # for proc we have CREATE and INSERT for all other only CREATE

let SEARCH_RANGE=500000000;
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20939.sql;
let SEARCH_PATTERN=INSERT INTO `proc`;
source include/search_pattern_in_file.inc;
let SEARCH_PATTERN=INSERT INTO `db`;
source include/search_pattern_in_file.inc;
let SEARCH_PATTERN=CREATE TABLE `db`;
source include/search_pattern_in_file.inc;
let SEARCH_PATTERN=CREATE TABLE `proc`;
source include/search_pattern_in_file.inc;

--remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20939.sql
drop user a;
use test;

--echo # End of 10.1 tests

--echo #
--echo # Test for --add-drop-trigger
--echo #

CREATE TABLE t1 (a int, b int);
CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW 
  SET NEW.b=NEW.a + 10;

INSERT INTO t1 (a) VALUES (1),(2),(3);
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --triggers --no-data --no-create-info --add-drop-trigger --skip-comments --databases test
DROP TABLE t1;

--echo #
--echo # MDEV-20939: Race condition between mysqldump import and InnoDB
--echo #             persistent statistics calculation
--echo #

--let $ignore= --ignore-table=mysql.proxies_priv --ignore-table=mysql.user --ignore-table=mysql.global_priv --ignore-table=mysql.column_stats --ignore-table=mysql.columns_priv --ignore-table=mysql.db --ignore-table=mysql.event --ignore-table=mysql.func --ignore-table=mysql.gtid_slave_pos --ignore-table=mysql.help_category --ignore-table=mysql.help_keyword --ignore-table=mysql.help_relation --ignore-table=mysql.help_topic --ignore-table=mysql.host --ignore-table=mysql.index_stats --ignore-table=mysql.plugin --ignore-table=mysql.proc --ignore-table=mysql.procs_priv --ignore-table=mysql.roles_mapping --ignore-table=mysql.servers --ignore-table=mysql.table_stats --ignore-table=mysql.tables_priv --ignore-table=mysql.time_zone --ignore-table=mysql.time_zone_leap_second --ignore-table=mysql.time_zone_name --ignore-table=mysql.time_zone_transition --ignore-table=mysql.time_zone_transition_type --ignore-table=mysql.general_log --ignore-table=mysql.slow_log
--let $skip_opts= --skip-dump-date --skip-comments

--echo #
--echo # Without --replace and --insert-ignore
--echo #
--exec $MYSQL_DUMP $ignore $skip_opts mysql

--echo #
--echo # With --replace
--echo #
--exec $MYSQL_DUMP $ignore $skip_opts --replace mysql

--echo #
--echo # With --insert-ignore
--echo #
--exec $MYSQL_DUMP $ignore $skip_opts --insert-ignore mysql

--echo # End of 10.2 tests

--echo #
--echo # Test for Invisible columns
--echo #
create database d;
use d;

--echo # Invisble field table
create table t1(a int , b int invisible);
insert into t1 values(1);
insert into t1(a,b) values(1,2);

--echo # not invisible field table --complete-insert wont be used
create table t2(a int , b int);
insert into t2(a,b) values(1,2);
insert into t2(a,b) values(1,2);

--echo # Invisble field table
create table t3(invisible int , `a  b c & $!@#$%^&*( )` int invisible default 4, `ds=~!@ \# $% ^ & * ( ) _ - = +` int invisible default 5);
insert into t3 values(1);
insert into t3 values(5);
insert into t3 values(2);
insert into t3(`invisible`,  `a  b c & $!@#$%^&*( )`, `ds=~!@ \# $% ^ & * ( ) _ - = +` ) values(1,2,3);
CREATE TABLE t4(ËÏÌÏÎËÁ1 INT);
insert into t4 values(1);
--exec $MYSQL_DUMP --compact d

--echo #Check side effect on --complete insert
--exec $MYSQL_DUMP --compact --complete-insert d
--echo #Check xml
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-create-options --skip-comments -X d

#import data
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --skip-comments d > $MYSQLTEST_VARDIR/tmp/invisible_dump.sql
DROP table t1,t2,t3;

--exec $MYSQL d < $MYSQLTEST_VARDIR/tmp/invisible_dump.sql

select * from t1;
select a,b from t1;
select * from t2;
select * from t3;
desc t3;
drop database d;

--echo #
--echo # MDEV-21786:
--echo # mysqldump will forget sequence definition details on --no-data dump
--echo #
--disable_ps2_protocol
create database d;

CREATE SEQUENCE d.s1 START WITH 100 INCREMENT BY 10 MINVALUE=100 MAXVALUE=1100 CYCLE;
CREATE SEQUENCE d.s2 START WITH 200 INCREMENT BY 20 MINVALUE=200 MAXVALUE=1200 CYCLE;
CREATE SEQUENCE d.s3 START WITH 300 INCREMENT BY 30 MINVALUE=300 MAXVALUE=1300 CYCLE;
CREATE SEQUENCE d.s4 START WITH 400 INCREMENT BY 40 MINVALUE=400 MAXVALUE=1400 CYCLE;
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);

--echo # Show create before dump
show create sequence d.s1;
show create sequence d.s2;
show create sequence d.s3;
show create sequence d.s4;

--echo # Dump sequence without `--no-data`
--exec $MYSQL_DUMP --databases d > $MYSQLTEST_VARDIR/tmp/dump1.sql
--echo # Restore from mysqldump
--exec $MYSQL -Dd < $MYSQLTEST_VARDIR/tmp/dump1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/dump1.sql

--echo # Show create after restore
show create sequence d.s1;
show create sequence d.s2;
show create sequence d.s3;
show create sequence d.s4;
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);

--echo # Dump sequence with `--no-data`
--exec $MYSQL_DUMP --databases d --no-data > $MYSQLTEST_VARDIR/tmp/dump-no-data.sql
--echo # Restore from mysqldump
--exec $MYSQL -Dd < $MYSQLTEST_VARDIR/tmp/dump-no-data.sql
--remove_file $MYSQLTEST_VARDIR/tmp/dump-no-data.sql

--echo # Show create after restore `--no-data`
show create sequence d.s1;
show create sequence d.s2;
show create sequence d.s3;
show create sequence d.s4;
SELECT NEXTVAL(d.s1),NEXTVAL(d.s2),NEXTVAL(d.s3), NEXTVAL(d.s4);

--echo # Restore to different database than original
--exec $MYSQL_DUMP d >  $MYSQLTEST_VARDIR/tmp/dumpd.sql
create database d2;
--exec $MYSQL d2 < $MYSQLTEST_VARDIR/tmp/dumpd.sql
--remove_file $MYSQLTEST_VARDIR/tmp/dumpd.sql
show create sequence d2.s1;

drop sequence d.s1, d.s2, d.s3, d.s4;
drop database d;
drop database d2;
--enable_ps2_protocol

--echo #
--echo # MDEV-20070
--echo # mysqldump won't work correct on sequences
--echo #

DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;
CREATE DATABASE test1;
CREATE DATABASE test2;
USE test1;
CREATE SEQUENCE seq_t_i INCREMENT 5 START WITH 1;
CREATE TABLE t(
i integer DEFAULT nextval(seq_t_i),
j integer
);
INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);

--echo # Dump database 1
--exec $MYSQL_DUMP test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo # Restore from database 1 to database 2

--error 1
--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql 2>&1

--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2;

--echo #
--echo # MDEV-27186 Server fails to load a dump, taken on the same version
--echo # Oracle mode with packages
--echo #

CREATE DATABASE test1;
CREATE DATABASE test2;
USE test1;
SET @save_sql_mode=@@sql_mode;
SET sql_mode=ORACLE;

DELIMITER $$;
CREATE OR REPLACE PACKAGE pkg AS
END;
$$

DELIMITER ;$$

--echo # Dump database 1
--exec $MYSQL_DUMP --routines test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo # Restore from database 1 to database 2

--exec $MYSQL test2 < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
use test2;
SHOW CREATE PACKAGE pkg;

DROP DATABASE test1;
DROP DATABASE test2;
SET sql_mode=@save_sql_mode;
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql
use test;

--echo #
--echo # MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_log
--echo #

CREATE DATABASE test1;
--echo # Dump mysql database
--exec $MYSQL_DUMP --add-drop-database --databases mysql test1 > $MYSQLTEST_VARDIR/tmp/dumptest1.sql

--disable_warnings
DROP VIEW IF EXISTS mysql.user;
DROP TABLE IF EXISTS mysql.global_priv;
DROP TABLE IF EXISTS mysql.user;
--enable_warnings
#DROP TABLE IF EXISTS mysql.transaction_registry;
#DROP TABLE IF EXISTS mysql.slow_log;
#DROP TABLE IF EXISTS mysql.general_log;
DROP TABLE IF EXISTS mysql.time_zone_transition_type;
DROP TABLE IF EXISTS mysql.time_zone_transition;
DROP TABLE IF EXISTS mysql.time_zone_name;
DROP TABLE IF EXISTS mysql.time_zone_leap_second;
DROP TABLE IF EXISTS mysql.time_zone;
DROP TABLE IF EXISTS mysql.tables_priv;
DROP TABLE IF EXISTS mysql.table_stats;
DROP TABLE IF EXISTS mysql.servers;
DROP TABLE IF EXISTS mysql.roles_mapping;
DROP TABLE IF EXISTS mysql.proxies_priv;
DROP TABLE IF EXISTS mysql.procs_priv;
DROP TABLE IF EXISTS mysql.proc;
DROP TABLE IF EXISTS mysql.plugin;
DROP TABLE IF EXISTS mysql.innodb_table_stats;
DROP TABLE IF EXISTS mysql.innodb_index_stats;
DROP TABLE IF EXISTS mysql.index_stats;
DROP TABLE IF EXISTS mysql.help_topic;
DROP TABLE IF EXISTS mysql.help_relation;
DROP TABLE IF EXISTS mysql.help_keyword;
DROP TABLE IF EXISTS mysql.help_category;
DROP TABLE IF EXISTS mysql.gtid_slave_pos;
DROP TABLE IF EXISTS mysql.func;
DROP TABLE IF EXISTS mysql.event;
DROP TABLE IF EXISTS mysql.db;
DROP TABLE IF EXISTS mysql.columns_priv;
DROP TABLE IF EXISTS mysql.column_stats;

--echo # Abbreviated contents
--replace_regex /Create_time="[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}"/Create_time="TIMESTAMP"/
--exec $MYSQL_DUMP --xml --skip-comments --no-data --add-drop-database --databases mysql test1

SET @save_general_log=@@GENERAL_LOG;
SET GLOBAL LOG_OUTPUT='TABLE', GLOBAL GENERAL_LOG=1;

--echo # Restore mysql database while general log is active
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/dumptest1.sql
--echo # No failure at this stage is the object of the test
SELECT @@GLOBAL.LOG_OUTPUT, @@GLOBAL.GENERAL_LOG;
SET GLOBAL LOG_OUTPUT=DEFAULT, GLOBAL GENERAL_LOG=@save_general_log;
TRUNCATE TABLE mysql.general_log;
DROP DATABASE test1;
--remove_file $MYSQLTEST_VARDIR/tmp/dumptest1.sql

--echo # End of 10.3 tests

--echo #
--echo # MDEV-31092 mysqldump --force doesn't ignore error as it should
--echo #
create function f1() returns int return 1;
create function f2() returns int return 2;
update mysql.proc set body='return no_such_var' where db='test' and name='f1';
create event e1 on schedule every 1 year starts '2030-01-01' do select 1;
update mysql.event set body ='select not_a_value' where db='test' and name='e1';
create table t1 (i int);
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --compact --events --routines --force test 2>&1
drop function f1;
drop function f2;
drop event e1;
drop table t1;

--echo # End of 10.4 tests

--echo #
--echo # MDEV-33727 mariadb-dump trusts the server and does not validate the data
--echo #

create table t1 (a int);
--exec $MYSQL_DUMP --compact --add-drop-table test > $MYSQLTEST_VARDIR/tmp/mdev33727.sql

# first let's verify it can be loaded not only by mariadb client
--source $MYSQLTEST_VARDIR/tmp/mdev33727.sql

# and now test the mariadb client sandbox protection
--append_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql
\! echo foo
EOF
--error 1
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mdev33727.sql 2>&1
--remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql
drop table t1;

--echo # End of 10.5 tests

--echo #
--echo # MDEV-16733 mysqldump --tab and --xml options are conflicting
--echo #
--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --xml --tab=$MYSQLTEST_VARDIR/tmp 2>&1

--echo # End of 10.11 tests

#
# MDEV-32589 parallel-mysqldump - test "too many connections"
#
select @@max_connections into @save_max_connections;
set global max_connections=10;
--replace_result mariadb-dump.exe mariadb-dump
--error 2
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --parallel=20 mysql 2>&1
#
# MDEV-32589 test builtin 256 connections limit
#
set global max_connections=300;
--replace_result mariadb-dump.exe mariadb-dump
--error 1
--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --parallel=280 mysql 2>&1
set global max_connections=@save_max_connections;

--echo #
--echo # End of 11.4 tests
--echo #