1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571
|
CREATE TABLE gis_point (fid INTEGER NOT NULL PRIMARY KEY, g POINT);
CREATE TABLE gis_line (fid INTEGER NOT NULL PRIMARY KEY, g LINESTRING);
CREATE TABLE gis_polygon (fid INTEGER NOT NULL PRIMARY KEY, g POLYGON);
CREATE TABLE gis_multi_point (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOINT);
CREATE TABLE gis_multi_line (fid INTEGER NOT NULL PRIMARY KEY, g MULTILINESTRING);
CREATE TABLE gis_multi_polygon (fid INTEGER NOT NULL PRIMARY KEY, g MULTIPOLYGON);
CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRYCOLLECTION);
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g point YES NULL
SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g linestring YES NULL
SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g polygon YES NULL
SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra
fid int(11) NO PRI NULL
g geometry YES NULL
INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')),
(102, PointFromText('POINT(20 10)')),
(103, PointFromText('POINT(20 20)')),
(104, PointFromWKB(AsWKB(PointFromText('POINT(10 20)'))));
INSERT INTO gis_line VALUES
(105, LineFromText('LINESTRING(0 0,0 10,10 0)')),
(106, LineStringFromText('LINESTRING(10 10,20 10,20 20,10 20,10 10)')),
(107, LineStringFromWKB(AsWKB(LineString(Point(10, 10), Point(40, 10)))));
INSERT INTO gis_polygon VALUES
(108, PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),
(109, PolyFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))')),
(110, PolyFromWKB(AsWKB(Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0))))));
INSERT INTO gis_multi_point VALUES
(111, MultiPointFromText('MULTIPOINT(0 0,10 10,10 20,20 20)')),
(112, MPointFromText('MULTIPOINT(1 1,11 11,11 21,21 21)')),
(113, MPointFromWKB(AsWKB(MultiPoint(Point(3, 6), Point(4, 10)))));
INSERT INTO gis_multi_line VALUES
(114, MultiLineStringFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')),
(115, MLineFromText('MULTILINESTRING((10 48,10 21,10 0))')),
(116, MLineFromWKB(AsWKB(MultiLineString(LineString(Point(1, 2), Point(3, 5)), LineString(Point(2, 5), Point(5, 8), Point(21, 7))))));
INSERT INTO gis_multi_polygon VALUES
(117, MultiPolygonFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(118, MPolyFromText('MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))')),
(119, MPolyFromWKB(AsWKB(MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3)))))));
INSERT INTO gis_geometrycollection VALUES
(120, GeomCollFromText('GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0,10 10))')),
(121, GeometryFromWKB(AsWKB(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)))))),
(122, GeomFromText('GeometryCollection()')),
(123, GeomFromText('GeometryCollection EMPTY'));
INSERT into gis_geometry SELECT * FROM gis_point;
INSERT into gis_geometry SELECT * FROM gis_line;
INSERT into gis_geometry SELECT * FROM gis_polygon;
INSERT into gis_geometry SELECT * FROM gis_multi_point;
INSERT into gis_geometry SELECT * FROM gis_multi_line;
INSERT into gis_geometry SELECT * FROM gis_multi_polygon;
INSERT into gis_geometry SELECT * FROM gis_geometrycollection;
SELECT fid, AsText(g) FROM gis_point;
fid AsText(g)
101 POINT(10 10)
102 POINT(20 10)
103 POINT(20 20)
104 POINT(10 20)
SELECT fid, AsText(g) FROM gis_line;
fid AsText(g)
105 LINESTRING(0 0,0 10,10 0)
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
107 LINESTRING(10 10,40 10)
SELECT fid, AsText(g) FROM gis_polygon;
fid AsText(g)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
SELECT fid, AsText(g) FROM gis_multi_point;
fid AsText(g)
111 MULTIPOINT(0 0,10 10,10 20,20 20)
112 MULTIPOINT(1 1,11 11,11 21,21 21)
113 MULTIPOINT(3 6,4 10)
SELECT fid, AsText(g) FROM gis_multi_line;
fid AsText(g)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
SELECT fid, AsText(g) FROM gis_multi_polygon;
fid AsText(g)
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
SELECT fid, AsText(g) FROM gis_geometrycollection;
fid AsText(g)
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
SELECT fid, AsText(g) FROM gis_geometry;
fid AsText(g)
101 POINT(10 10)
102 POINT(20 10)
103 POINT(20 20)
104 POINT(10 20)
105 LINESTRING(0 0,0 10,10 0)
106 LINESTRING(10 10,20 10,20 20,10 20,10 10)
107 LINESTRING(10 10,40 10)
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0),(10 10,20 10,20 20,10 20,10 10))
110 POLYGON((0 0,30 0,30 30,0 0))
111 MULTIPOINT(0 0,10 10,10 20,20 20)
112 MULTIPOINT(1 1,11 11,11 21,21 21)
113 MULTIPOINT(3 6,4 10)
114 MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))
115 MULTILINESTRING((10 48,10 21,10 0))
116 MULTILINESTRING((1 2,3 5),(2 5,5 8,21 7))
117 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
118 MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))
119 MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
120 GEOMETRYCOLLECTION(POINT(0 0),LINESTRING(0 0,10 10))
121 GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
SELECT fid, Dimension(g) FROM gis_geometry;
fid Dimension(g)
101 0
102 0
103 0
104 0
105 1
106 1
107 1
108 2
109 2
110 2
111 0
112 0
113 0
114 1
115 1
116 1
117 2
118 2
119 2
120 1
121 1
122 0
123 0
SELECT fid, GeometryType(g) FROM gis_geometry;
fid GeometryType(g)
101 POINT
102 POINT
103 POINT
104 POINT
105 LINESTRING
106 LINESTRING
107 LINESTRING
108 POLYGON
109 POLYGON
110 POLYGON
111 MULTIPOINT
112 MULTIPOINT
113 MULTIPOINT
114 MULTILINESTRING
115 MULTILINESTRING
116 MULTILINESTRING
117 MULTIPOLYGON
118 MULTIPOLYGON
119 MULTIPOLYGON
120 GEOMETRYCOLLECTION
121 GEOMETRYCOLLECTION
122 GEOMETRYCOLLECTION
123 GEOMETRYCOLLECTION
SELECT fid, IsEmpty(g) FROM gis_geometry;
fid IsEmpty(g)
101 0
102 0
103 0
104 0
105 0
106 0
107 0
108 0
109 0
110 0
111 0
112 0
113 0
114 0
115 0
116 0
117 0
118 0
119 0
120 0
121 0
122 0
123 0
SELECT fid, AsText(Envelope(g)) FROM gis_geometry;
fid AsText(Envelope(g))
101 POLYGON((10 10,10 10,10 10,10 10,10 10))
102 POLYGON((20 10,20 10,20 10,20 10,20 10))
103 POLYGON((20 20,20 20,20 20,20 20,20 20))
104 POLYGON((10 20,10 20,10 20,10 20,10 20))
105 POLYGON((0 0,10 0,10 10,0 10,0 0))
106 POLYGON((10 10,20 10,20 20,10 20,10 10))
107 POLYGON((10 10,40 10,40 10,10 10,10 10))
108 POLYGON((10 10,20 10,20 20,10 20,10 10))
109 POLYGON((0 0,50 0,50 50,0 50,0 0))
110 POLYGON((0 0,30 0,30 30,0 30,0 0))
111 POLYGON((0 0,20 0,20 20,0 20,0 0))
112 POLYGON((1 1,21 1,21 21,1 21,1 1))
113 POLYGON((3 6,4 6,4 10,3 10,3 6))
114 POLYGON((10 0,16 0,16 48,10 48,10 0))
115 POLYGON((10 0,10 0,10 48,10 48,10 0))
116 POLYGON((1 2,21 2,21 8,1 8,1 2))
117 POLYGON((28 0,84 0,84 42,28 42,28 0))
118 POLYGON((28 0,84 0,84 42,28 42,28 0))
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
122 GEOMETRYCOLLECTION EMPTY
123 GEOMETRYCOLLECTION EMPTY
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from gis_geometry;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_geometry ALL NULL NULL NULL NULL 23 100.00
Warnings:
Note 1003 select st_dimension(`test`.`gis_geometry`.`g`) AS `Dimension(g)`,st_geometrytype(`test`.`gis_geometry`.`g`) AS `GeometryType(g)`,st_isempty(`test`.`gis_geometry`.`g`) AS `IsEmpty(g)`,st_astext(st_envelope(`test`.`gis_geometry`.`g`)) AS `AsText(Envelope(g))` from `test`.`gis_geometry`
SELECT fid, X(g) FROM gis_point;
fid X(g)
101 10
102 20
103 20
104 10
SELECT fid, Y(g) FROM gis_point;
fid Y(g)
101 10
102 10
103 20
104 20
explain extended select X(g),Y(g) FROM gis_point;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_point ALL NULL NULL NULL NULL 4 100.00
Warnings:
Note 1003 select st_x(`test`.`gis_point`.`g`) AS `X(g)`,st_y(`test`.`gis_point`.`g`) AS `Y(g)` from `test`.`gis_point`
SELECT fid, AsText(StartPoint(g)) FROM gis_line;
fid AsText(StartPoint(g))
105 POINT(0 0)
106 POINT(10 10)
107 POINT(10 10)
SELECT fid, AsText(EndPoint(g)) FROM gis_line;
fid AsText(EndPoint(g))
105 POINT(10 0)
106 POINT(10 10)
107 POINT(40 10)
SELECT fid, GLength(g) FROM gis_line;
fid GLength(g)
105 24.14213562373095
106 40
107 30
SELECT fid, NumPoints(g) FROM gis_line;
fid NumPoints(g)
105 3
106 5
107 2
SELECT fid, AsText(PointN(g, 2)) FROM gis_line;
fid AsText(PointN(g, 2))
105 POINT(0 10)
106 POINT(20 10)
107 POINT(40 10)
SELECT fid, IsClosed(g) FROM gis_line;
fid IsClosed(g)
105 0
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM gis_line;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_line ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select st_astext(st_startpoint(`test`.`gis_line`.`g`)) AS `AsText(StartPoint(g))`,st_astext(st_endpoint(`test`.`gis_line`.`g`)) AS `AsText(EndPoint(g))`,st_length(`test`.`gis_line`.`g`) AS `GLength(g)`,st_numpoints(`test`.`gis_line`.`g`) AS `NumPoints(g)`,st_astext(st_pointn(`test`.`gis_line`.`g`,2)) AS `AsText(PointN(g, 2))`,st_isclosed(`test`.`gis_line`.`g`) AS `IsClosed(g)` from `test`.`gis_line`
SELECT fid, AsText(Centroid(g)) FROM gis_polygon;
fid AsText(Centroid(g))
108 POINT(15 15)
109 POINT(25.416666666666668 25.416666666666668)
110 POINT(20 10)
SELECT fid, Area(g) FROM gis_polygon;
fid Area(g)
108 100
109 2400
110 450
SELECT fid, AsText(ExteriorRing(g)) FROM gis_polygon;
fid AsText(ExteriorRing(g))
108 LINESTRING(10 10,20 10,20 20,10 20,10 10)
109 LINESTRING(0 0,50 0,50 50,0 50,0 0)
110 LINESTRING(0 0,30 0,30 30,0 0)
SELECT fid, NumInteriorRings(g) FROM gis_polygon;
fid NumInteriorRings(g)
108 0
109 1
110 0
SELECT fid, AsText(InteriorRingN(g, 1)) FROM gis_polygon;
fid AsText(InteriorRingN(g, 1))
108 NULL
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM gis_polygon;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_polygon ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select st_astext(st_centroid(`test`.`gis_polygon`.`g`)) AS `AsText(Centroid(g))`,st_area(`test`.`gis_polygon`.`g`) AS `Area(g)`,st_astext(st_exteriorring(`test`.`gis_polygon`.`g`)) AS `AsText(ExteriorRing(g))`,st_numinteriorrings(`test`.`gis_polygon`.`g`) AS `NumInteriorRings(g)`,st_astext(st_interiorringn(`test`.`gis_polygon`.`g`,1)) AS `AsText(InteriorRingN(g, 1))` from `test`.`gis_polygon`
SELECT fid, IsClosed(g) FROM gis_multi_line;
fid IsClosed(g)
114 0
115 0
116 0
SELECT fid, AsText(Centroid(g)) FROM gis_multi_polygon;
fid AsText(Centroid(g))
117 POINT(57.98031067576927 17.854754130800433)
118 POINT(57.98031067576927 17.854754130800433)
119 POINT(2 2)
SELECT fid, Area(g) FROM gis_multi_polygon;
fid Area(g)
117 1684.5
118 1684.5
119 4.5
SELECT fid, NumGeometries(g) from gis_multi_point;
fid NumGeometries(g)
111 4
112 4
113 2
SELECT fid, NumGeometries(g) from gis_multi_line;
fid NumGeometries(g)
114 2
115 1
116 2
SELECT fid, NumGeometries(g) from gis_multi_polygon;
fid NumGeometries(g)
117 2
118 2
119 1
SELECT fid, NumGeometries(g) from gis_geometrycollection;
fid NumGeometries(g)
120 2
121 2
122 0
123 0
explain extended SELECT fid, NumGeometries(g) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_numgeometries(`test`.`gis_multi_point`.`g`) AS `NumGeometries(g)` from `test`.`gis_multi_point`
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
fid AsText(GeometryN(g, 2))
111 POINT(10 10)
112 POINT(11 11)
113 POINT(4 10)
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_line;
fid AsText(GeometryN(g, 2))
114 LINESTRING(16 0,16 23,16 48)
115 NULL
116 LINESTRING(2 5,5 8,21 7)
SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_polygon;
fid AsText(GeometryN(g, 2))
117 POLYGON((59 18,67 18,67 13,59 13,59 18))
118 POLYGON((59 18,67 18,67 13,59 13,59 18))
119 NULL
SELECT fid, AsText(GeometryN(g, 2)) from gis_geometrycollection;
fid AsText(GeometryN(g, 2))
120 LINESTRING(0 0,10 10)
121 LINESTRING(3 6,7 9)
122 NULL
123 NULL
SELECT fid, AsText(GeometryN(g, 1)) from gis_geometrycollection;
fid AsText(GeometryN(g, 1))
120 POINT(0 0)
121 POINT(44 6)
122 NULL
123 NULL
explain extended SELECT fid, AsText(GeometryN(g, 2)) from gis_multi_point;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE gis_multi_point ALL NULL NULL NULL NULL 3 100.00
Warnings:
Note 1003 select `test`.`gis_multi_point`.`fid` AS `fid`,st_astext(st_geometryn(`test`.`gis_multi_point`.`g`,2)) AS `AsText(GeometryN(g, 2))` from `test`.`gis_multi_point`
SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
120 121 0 0 1 0 0 0 1 0
120 122 NULL NULL NULL NULL NULL NULL NULL NULL
120 123 NULL NULL NULL NULL NULL NULL NULL NULL
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
121 122 NULL NULL NULL NULL NULL NULL NULL NULL
121 123 NULL NULL NULL NULL NULL NULL NULL NULL
122 120 NULL NULL NULL NULL NULL NULL NULL NULL
122 121 NULL NULL NULL NULL NULL NULL NULL NULL
122 122 NULL NULL NULL NULL NULL NULL NULL NULL
122 123 NULL NULL NULL NULL NULL NULL NULL NULL
123 120 NULL NULL NULL NULL NULL NULL NULL NULL
123 121 NULL NULL NULL NULL NULL NULL NULL NULL
123 122 NULL NULL NULL NULL NULL NULL NULL NULL
123 123 NULL NULL NULL NULL NULL NULL NULL NULL
explain extended SELECT g1.fid as first, g2.fid as second,
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 4 100.00 Using join buffer (flat, BNL join)
Warnings:
Note 1003 select `test`.`g1`.`fid` AS `first`,`test`.`g2`.`fid` AS `second`,st_within(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `w`,st_contains(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `c`,mbroverlaps(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `o`,st_equals(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `e`,mbrdisjoint(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `d`,st_touches(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `t`,mbrintersects(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `i`,st_crosses(`test`.`g1`.`g`,`test`.`g2`.`g`) AS `r` from `test`.`gis_geometrycollection` `g1` join `test`.`gis_geometrycollection` `g2` order by `test`.`g1`.`fid`,`test`.`g2`.`fid`
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE t1 (
gp point,
ln linestring,
pg polygon,
mp multipoint,
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
mp multipoint YES NULL
mln multilinestring YES NULL
mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
ALTER TABLE t1 ADD fid INT NOT NULL;
SHOW FIELDS FROM t1;
Field Type Null Key Default Extra
gp point YES NULL
ln linestring YES NULL
pg polygon YES NULL
mp multipoint YES NULL
mln multilinestring YES NULL
mpg multipolygon YES NULL
gc geometrycollection YES NULL
gm geometry YES NULL
fid int(11) NO NULL
DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) as exp;
exp
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select st_astext(st_geometryfromwkb(st_aswkb(st_geometryfromtext('POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select srid(st_geometryfromtext('LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select st_issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,st_issimple(point(3,6)) AS `issimple(Point(3, 6))`
create table t1 (a geometry not null);
insert into t1 values (GeomFromText('Point(1 2)'));
insert into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert IGNORE into t1 values ('Garbage');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
alter table t1 add spatial index(a);
drop table t1;
create table t1(a geometry not null, spatial index(a));
insert into t1 values
(GeomFromText('POINT(1 1)')), (GeomFromText('POINT(3 3)')),
(GeomFromText('POINT(4 4)')), (GeomFromText('POINT(6 6)'));
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
or
MBRContains(GeomFromText('Polygon((2 2, 2 5, 5 5, 5 2, 2 2))'), a);
AsText(a)
POINT(1 1)
POINT(3 3)
POINT(4 4)
select AsText(a) from t1 where
MBRContains(GeomFromText('Polygon((0 0, 0 2, 2 2, 2 0, 0 0))'), a)
and
MBRContains(GeomFromText('Polygon((0 0, 0 7, 7 7, 7 0, 0 0))'), a);
AsText(a)
POINT(1 1)
drop table t1;
CREATE TABLE t1 (Coordinates POINT NOT NULL, SPATIAL INDEX(Coordinates));
INSERT INTO t1 VALUES(GeomFromText('POINT(383293632 1754448)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(564952612 157516260)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(903994614 180726515)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(98128178 141127631)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(862547902 799334546)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(341989013 850270906)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(803302376 93039099)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(857439153 817431356)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(319757546 343162742)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(826341972 717484432)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(305066789 201736238)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(626068992 616241497)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(55789424 755830108)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(802874458 312435220)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(153795660 551723671)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(242207428 537089292)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(553478119 807160039)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(694605552 457472733)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(987886554 792733729)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(598600363 850434457)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(592068275 940589376)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(700705362 395370650)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(33628474 558144514)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(212802006 353386020)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(901307256 39143977)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(70870451 206374045)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(240880214 696939443)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(822615542 296669638)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(452769551 625489999)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(609104858 606565210)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(177213669 851312285)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(143654501 730691787)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(658472325 838260052)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(188164520 646358878)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(630993781 786764883)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(496793334 223062055)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(727354258 197498696)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(618432704 760982731)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(755643210 831234710)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(114368751 656950466)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(870378686 185239202)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(863324511 111258900)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(882178645 685940052)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(407928538 334948195)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(311430051 17033395)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(941513405 488643719)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(868345680 85167906)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(219335507 526818004)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(923427958 407500026)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(173176882 554421738)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(194264908 669970217)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(777483793 921619165)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(867468912 395916497)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(682601897 623112122)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(227151206 796970647)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(280062588 97529892)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(982209849 143387099)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(208788792 864388493)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(829327151 616717329)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(199336688 140757201)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(633750724 140850093)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(629400920 502096404)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(226017998 848736426)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(28914408 149445955)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(256236452 202091290)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(703867693 450501360)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(872061506 481351486)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(372120524 739530418)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(877267982 54722420)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(362642540 104419188)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(851693067 642705127)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(201949080 833902916)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(786092225 410737872)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(698291409 615419376)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(27455201 897628096)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(756176576 661205925)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(38478189 385577496)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(163302328 264496186)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(234313922 192216735)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(413942141 490550373)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(394308025 117809834)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(941051732 266369530)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(599161319 313172256)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(5899948 476429301)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(367894677 368542487)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(580848489 219587743)'));
INSERT INTO t1 VALUES(GeomFromText('POINT(11247614 782797569)'));
drop table t1;
create table t1 select GeomFromWKB(POINT(1,3));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`GeomFromWKB(POINT(1,3))` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1;
CREATE TABLE `t1` (`object_id` bigint(20) unsigned NOT NULL default '0', `geo`
geometry NOT NULL default '') ENGINE=MyISAM ;
insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
36.305435,-114.992394 36.305202,-114.991219 36.305975,-114.991163
36.306845,-114.989432 36.309452,-114.978275 36.312642,-114.977363
36.311978,-114.975327 36.312344,-114.96502 36.31597,-114.963364
36.313629,-114.961723 36.313721,-114.956398 36.316057,-114.951882
36.320979,-114.947073 36.323475,-114.945207 36.326451,-114.945207
36.326451,-114.944132 36.326061,-114.94003 36.326588,-114.924017
36.334484,-114.923281 36.334146,-114.92564 36.331504,-114.94072
36.319282,-114.945348 36.314812,-114.948091 36.314762,-114.951755
36.316211,-114.952446 36.313883,-114.952644 36.309488,-114.944725
36.313083,-114.93706 36.32043,-114.932478 36.323497,-114.924556
36.327708,-114.922608 36.329715,-114.92009 36.328695,-114.912105
36.323566,-114.901647 36.317952,-114.897436 36.313968,-114.895344
36.309573,-114.891699 36.304398,-114.890569 36.303551,-114.886356
36.302702,-114.885141 36.301351,-114.885709 36.297391,-114.892499
36.290893,-114.902142 36.288974,-114.904941 36.288838,-114.905308
36.289845,-114.906325 36.290395,-114.909916 36.289549,-114.914527
36.287535,-114.918797 36.284423,-114.922982 36.279731,-114.924113
36.277282,-114.924057 36.275817,-114.927733 36.27053,-114.929354
36.269029,-114.929354 36.269029,-114.950856 36.268715,-114.950768
36.264324,-114.960206 36.264293,-114.960301 36.268943,-115.006662
36.268929,-115.008583 36.265619,-115.00665 36.264247,-115.006659
36.246873,-115.006659 36.246873,-115.006838 36.247697,-115.010764
36.247774,-115.015609 36.25113,-115.015765 36.254505,-115.029517
36.254619,-115.038573 36.249317,-115.038573 36.249317,-115.023403
36.25841,-115.023873 36.258994,-115.031845 36.259829,-115.03183
36.261053,-115.025561 36.261095,-115.036417 36.274632,-115.033729
36.276041,-115.032217 36.274851,-115.029845 36.273959,-115.029934
36.274966,-115.025763 36.274896,-115.025406 36.281044,-115.028731
36.284471,-115.036497 36.290377,-115.042071 36.291039,-115.026759
36.298478,-115.008995 36.301966,-115.006363 36.305435),(-115.079835
36.244369,-115.079735 36.260186,-115.076435 36.262369,-115.069758
36.265,-115.070235 36.268757,-115.064542 36.268655,-115.061843
36.269857,-115.062676 36.270693,-115.06305 36.272344,-115.059051
36.281023,-115.05918 36.283008,-115.060591 36.285246,-115.061913
36.290022,-115.062499 36.306353,-115.062499 36.306353,-115.060918
36.30642,-115.06112 36.289779,-115.05713 36.2825,-115.057314
36.279446,-115.060779 36.274659,-115.061366 36.27209,-115.057858
36.26557,-115.055805 36.262883,-115.054688 36.262874,-115.047335
36.25037,-115.044234 36.24637,-115.052434 36.24047,-115.061734
36.23507,-115.061934 36.22677,-115.061934 36.22677,-115.061491
36.225267,-115.062024 36.218194,-115.060134 36.218278,-115.060133
36.210771,-115.057833 36.210771,-115.057433 36.196271,-115.062233
36.196271,-115.062233 36.190371,-115.062233 36.190371,-115.065533
36.190371,-115.071333 36.188571,-115.098331 36.188275,-115.098331
36.188275,-115.098435 36.237569,-115.097535 36.240369,-115.097535
36.240369,-115.093235 36.240369,-115.089135 36.240469,-115.083135
36.240569,-115.083135 36.240569,-115.079835
36.244369)))')),('85998',GeomFromText('MULTIPOLYGON(((-115.333107
36.264587,-115.333168 36.280638,-115.333168 36.280638,-115.32226
36.280643,-115.322538 36.274311,-115.327222 36.274258,-115.32733
36.263026,-115.330675 36.262984,-115.332132 36.264673,-115.333107
36.264587),(-115.247239 36.247066,-115.247438 36.218267,-115.247438
36.218267,-115.278525 36.219263,-115.278525 36.219263,-115.301545
36.219559,-115.332748 36.219197,-115.332757 36.220041,-115.332757
36.220041,-115.332895 36.233514,-115.349023 36.233479,-115.351489
36.234475,-115.353681 36.237021,-115.357106 36.239789,-115.36519
36.243331,-115.368156 36.243487,-115.367389 36.244902,-115.364553
36.246014,-115.359219 36.24616,-115.356186 36.248025,-115.353347
36.248004,-115.350813 36.249507,-115.339673 36.25387,-115.333069
36.255018,-115.333069 36.255018,-115.333042 36.247767,-115.279039
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
85998 MULTIPOLYGON 1 POINT(115.2970604672862 -36.23335610879993)
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85984;
object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo))
85984 MULTIPOLYGON 1 POINT(-114.86854472054372 36.34725218253213)
drop table t1;
create table t1 (fl geometry not null);
insert into t1 values (1);
ERROR HY000: Cannot cast 'int' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values (1.11);
ERROR HY000: Cannot cast 'decimal' as 'geometry' in assignment of `test`.`t1`.`fl`
insert into t1 values ("qwerty");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
select (asWKT(geomfromwkb((0x000000000140240000000000004024000000000000)))) as exp;
exp
POINT(10 10)
select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as exp;
exp
POINT(10 10)
create table t1 (g GEOMETRY);
select * from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 g g 255 4294967295 0 Y 144 0 63
g
select asbinary(g) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def asbinary(g) 251 4294967295 0 Y 128 0 63
asbinary(g)
drop table t1;
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
alter table t1 disable keys;
load data infile '../../std_data/bad_gis_data.dat' into table t1;
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
alter table t1 enable keys;
drop table t1;
create table t1 (a int, b blob);
insert into t1 values (1, ''), (2, NULL), (3, '1');
select * from t1;
a b
1
2 NULL
3 1
select
geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
y(b) IS NULL
from t1;
ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
select
within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
intersects(b, b) IS NULL, crosses(b, b) IS NULL
from t1;
within(b, b) IS NULL contains(b, b) IS NULL overlaps(b, b) IS NULL equals(b, b) IS NULL disjoint(b, b) IS NULL touches(b, b) IS NULL intersects(b, b) IS NULL crosses(b, b) IS NULL
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
select
point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
multilinestring(b) IS NULL, multipolygon(b) IS NULL,
geometrycollection(b) IS NULL
from t1;
ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
drop table t1;
CREATE TABLE t1(a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL);
SELECT * FROM t1;
a
NULL
DROP TABLE t1;
CREATE TABLE `t1` ( `col9` set('a'), `col89` date);
INSERT INTO `t1` VALUES ('','0000-00-00');
select geomfromtext(col9,col89) as a from t1;
a
NULL
DROP TABLE t1;
CREATE TABLE t1 (
geomdata polygon NOT NULL,
SPATIAL KEY index_geom (geomdata)
) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
CREATE TABLE t2 (
geomdata polygon NOT NULL,
SPATIAL KEY index_geom (geomdata)
) ENGINE=MyISAM DEFAULT CHARSET=latin2 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED;
CREATE TABLE t3
select
aswkb(ws.geomdata) AS geomdatawkb
from
t1 ws
union
select
aswkb(ws.geomdata) AS geomdatawkb
from
t2 ws;
describe t3;
Field Type Null Key Default Extra
geomdatawkb longblob YES NULL
drop table t1;
drop table t2;
drop table t3;
create table t1(col1 geometry default null,col15 geometrycollection not
null,spatial index(col15),index(col1(15)))engine=myisam;
insert into t1 set col15 = GeomFromText('POINT(6 5)');
insert into t1 set col15 = GeomFromText('POINT(6 5)');
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
End of 4.1 tests
create table t1 (s1 geometry not null,s2 char(100));
create trigger t1_bu before update on t1 for each row set new.s1 = null;
insert into t1 values (null,null);
ERROR 23000: Column 's1' cannot be null
drop table t1;
drop procedure if exists fn3;
create function fn3 () returns point deterministic return GeomFromText("point(1 1)");
show create function fn3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
fn3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `fn3`() RETURNS point
DETERMINISTIC
return GeomFromText("point(1 1)") latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
select astext(fn3());
astext(fn3())
POINT(1 1)
drop function fn3;
create table t1(pt POINT);
alter table t1 add primary key pti(pt);
Warnings:
Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1(pt GEOMETRY);
alter table t1 add primary key pti(pt);
ERROR 42000: BLOB/TEXT column 'pt' used in key specification without a key length
alter table t1 add primary key pti(pt(20));
Warnings:
Warning 1280 Name 'pti' ignored for PRIMARY key.
drop table t1;
create table t1 select GeomFromText('point(1 1)');
desc t1;
Field Type Null Key Default Extra
GeomFromText('point(1 1)') geometry YES NULL
drop table t1;
create table t1 (g geometry not null);
insert into t1 values(default);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
drop table t1;
CREATE TABLE t1 (a GEOMETRY);
CREATE VIEW v1 AS SELECT GeomFromwkb(ASBINARY(a)) FROM t1;
CREATE VIEW v2 AS SELECT a FROM t1;
DESCRIBE v1;
Field Type Null Key Default Extra
GeomFromwkb(ASBINARY(a)) geometry YES NULL
DESCRIBE v2;
Field Type Null Key Default Extra
a geometry YES NULL
DROP VIEW v1,v2;
DROP TABLE t1;
create table t1 (name VARCHAR(100), square GEOMETRY);
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrcontains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrdisjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrequal
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrintersect
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbroverlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrtouches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
mbrwithin
big,center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
contains
center,small
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
disjoint
down3,left3,right3,up3
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
equals
center
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersects FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
intersects
big,center,down,down2,left,left2,right,right2,small,up,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
overlaps
down,left,right,up
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
touches
down2,left2,right2,up2
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
within
big,center
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
SET @point1 = GeomFromText('POLYGON ((0 0))');
SET @point2 = GeomFromText('POLYGON ((-2 0))');
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
overlaps
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
overlaps
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
Overlaps(@horiz1, @vert1)
0
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
Overlaps(@horiz1, @horiz2)
1
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
Overlaps(@horiz1, @horiz3)
0
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
Overlaps(@horiz1, @point1)
0
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
Overlaps(@horiz1, @point2)
0
DROP TABLE t1;
create table t1(f1 geometry, f2 linestring, f3 linestring);
select f1 from t1 union select f1 from t1;
f1
insert into t1 (f2,f3) values (GeomFromText('LINESTRING(1 1, 2 2)'),
GeomFromText('LINESTRING(0 0,1 1,2 2)'));
select AsText(f2),AsText(f3) from t1;
AsText(f2) AsText(f3)
LINESTRING(1 1,2 2) LINESTRING(0 0,1 1,2 2)
select AsText(a) from (select f2 as a from t1 union select f3 from t1) t;
AsText(a)
LINESTRING(1 1,2 2)
LINESTRING(0 0,1 1,2 2)
create table t2 as select f2 as a from t1 union select f3 from t1;
desc t2;
Field Type Null Key Default Extra
a linestring YES NULL
select AsText(a) from t2;
AsText(a)
LINESTRING(1 1,2 2)
LINESTRING(0 0,1 1,2 2)
drop table t1, t2;
SELECT 1;
1
1
CREATE TABLE t1 (p POINT);
CREATE TABLE t2 (p POINT, INDEX(p));
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)'));
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 system p NULL NULL NULL 1
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)'));
INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)'));
EXPLAIN
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref p p 28 const # Using where
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
EXPLAIN
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where
SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*)
1
DROP TABLE t1, t2;
End of 5.0 tests
#
# Test for bug #58650 "Failing assertion: primary_key_no == -1 ||
# primary_key_no == 0".
#
drop table if exists t1;
# The minimal test case.
create table t1 (a int not null, b linestring not null, unique key b (b(12)), unique key a (a));
drop table t1;
# The original test case.
create table t1 (a int not null, b linestring not null, unique key b (b(12)));
create unique index a on t1(a);
drop table t1;
create table `t1` (`col002` point)engine=myisam;
insert into t1 values (),(),();
select min(`col002`) from t1 union select `col002` from t1;
min(`col002`)
NULL
drop table t1;
#
# Bug #47780: crash when comparing GIS items from subquery
#
CREATE TABLE t1(a INT, b MULTIPOLYGON);
INSERT INTO t1 VALUES
(0,
GEOMFROMTEXT(
'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))'));
# must not crash
SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1);
ERROR HY000: Illegal parameter data types int and geometry for operation '<>'
DROP TABLE t1;
#
# Bug #49250 : spatial btree index corruption and crash
# Part one : spatial syntax check
#
CREATE TABLE t1(col1 MULTIPOLYGON NOT NULL,
SPATIAL INDEX USING BTREE (col1));
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1))' at line 2
CREATE TABLE t2(col1 MULTIPOLYGON NOT NULL);
CREATE SPATIAL INDEX USING BTREE ON t2(col);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE ON t2(col)' at line 1
ALTER TABLE t2 ADD SPATIAL INDEX USING BTREE (col1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USING BTREE (col1)' at line 1
DROP TABLE t2;
End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
Field Type Null Key Default Extra
f1 tinyint(1) YES NULL
f2 char(1) YES NULL
f3 varchar(1) YES NULL
f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
SELECT MultiPoint(12345,'');
ERROR HY000: Illegal parameter data type int for operation 'multipoint'
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
ERROR HY000: Illegal parameter data type varchar for operation 'geometrycollection'
#
# BUG#51875: crash when loading data into geometry function polyfromwkb
#
SET @a=0x00000000030000000100000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000000001840000000000000184000000000000014400000000000001440;
SET @a=POLYFROMWKB(@a);
create table t1(a geometry NOT NULL)engine=myisam;
insert into t1 values (geomfromtext("point(0 1)"));
insert into t1 values (geomfromtext("point(1 0)"));
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
NULL
NULL
drop table t1;
#
# Test for bug #59888 "debug assertion when attempt to create spatial index
# on char > 31 bytes".
#
create table t1(a char(32) not null) engine=myisam;
create spatial index i on t1 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
drop table t1;
CREATE TABLE t0 (a BINARY(32) NOT NULL);
CREATE SPATIAL INDEX i on t0 (a);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
INSERT INTO t0 VALUES (1);
CREATE TABLE t1(
col0 BINARY NOT NULL,
col2 TIMESTAMP,
SPATIAL INDEX i1 (col0)
) ENGINE=MyISAM;
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t1 (
col0 BINARY NOT NULL,
col2 TIMESTAMP
) ENGINE=MyISAM;
CREATE SPATIAL INDEX idx0 ON t1(col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
ALTER TABLE t1 ADD SPATIAL INDEX i1 (col0);
ERROR HY000: Incorrect arguments to SPATIAL INDEX
CREATE TABLE t2 (
col0 INTEGER NOT NULL,
col1 POINT,
col2 POINT
);
DROP TABLE t0, t1, t2;
#
# BUG#12414917 - ISCLOSED() CRASHES ON 64-BIT BUILDS
#
SELECT ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)));
ISCLOSED(CONVERT(CONCAT(' ', 0x2), BINARY(20)))
-1
#
# BUG#12537203 - CRASH WHEN SUBSELECTING GLOBAL VARIABLES IN
# GEOMETRY FUNCTION ARGUMENTS
#
SELECT GEOMETRYCOLLECTION((SELECT @@OLD));
ERROR HY000: Illegal parameter data type bigint for operation 'geometrycollection'
#
# MDEV-4252 geometry query crashes server
#
select astext(0x0100000000030000000100000000000010);
astext(0x0100000000030000000100000000000010)
NULL
select astext(st_centroid(0x0100000000030000000100000000000010));
astext(st_centroid(0x0100000000030000000100000000000010))
NULL
select astext(st_exteriorring(0x0100000000030000000100000000000010));
astext(st_exteriorring(0x0100000000030000000100000000000010))
NULL
select envelope(0x0100000000030000000100000000000010);
envelope(0x0100000000030000000100000000000010)
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
select geometryn(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-4296 Assertion `n_linear_rings > 0' fails in Gis_polygon::centroid_xy
#
SELECT Centroid( AsBinary( LineString(Point(0,0), Point(0,0), Point(0,0) ))) as exp;
exp
NULL
#
# MDEV-4295 Server crashes in get_point on a query with Area, AsBinary, MultiPoint
#
SELECT Area(AsBinary(MultiPoint(Point(0,9), Point(0,1), Point(2,2)))) as exp;
exp
NULL
End of 5.1 tests
select ST_AREA(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 31 10, 77 80), POLYGON((0 0,4 7,1 1,0 0)), POINT(20 20))')) as exp;
exp
1.5
select ST_LENGTH(ST_GEOMCOLLFROMTEXT(' GEOMETRYCOLLECTION(LINESTRING(100 100, 100 30, 20 30), POINT(3 3), LINESTRING(20 20, 30 20))')) as exp;
exp
160
DROP DATABASE IF EXISTS gis_ogs;
CREATE DATABASE gis_ogs;
USE gis_ogs;
#
# C.3.3.1 Geometry types and functions schema construction
#
CREATE TABLE lakes (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
shore POLYGON);
CREATE TABLE road_segments (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
aliases CHARACTER VARYING(64),
num_lanes INTEGER,
centerline LINESTRING);
CREATE TABLE divided_routes (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
num_lanes INTEGER,
centerlines MULTILINESTRING);
CREATE TABLE forests (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
boundary MULTIPOLYGON);
CREATE TABLE bridges (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
position POINT);
CREATE TABLE streams (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
centerline LINESTRING);
CREATE TABLE buildings (
fid INTEGER NOT NULL PRIMARY KEY,
address CHARACTER VARYING(64),
position POINT,
footprint POLYGON);
CREATE TABLE ponds (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
type CHARACTER VARYING(64),
shores MULTIPOLYGON);
CREATE TABLE named_places (
fid INTEGER NOT NULL PRIMARY KEY,
name CHARACTER VARYING(64),
boundary POLYGON);
CREATE TABLE map_neatlines (
fid INTEGER NOT NULL PRIMARY KEY,
neatline POLYGON);
#
# C.3.3.2 Geometry types and functions schema data loading
#
# Lakes
INSERT INTO lakes VALUES (
101, 'BLUE LAKE',
PolyFromText(
'POLYGON(
(52 18,66 23,73 9,48 6,52 18),
(59 18,67 18,67 13,59 13,59 18)
)',
101));
# Road Segments
INSERT INTO road_segments VALUES(102, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 0 18, 10 21, 16 23, 28 26, 44 31 )' ,101));
INSERT INTO road_segments VALUES(103, 'Route 5', 'Main Street', 4,
LineFromText(
'LINESTRING( 44 31, 56 34, 70 38 )' ,101));
INSERT INTO road_segments VALUES(104, 'Route 5', NULL, 2,
LineFromText(
'LINESTRING( 70 38, 72 48 )' ,101));
INSERT INTO road_segments VALUES(105, 'Main Street', NULL, 4,
LineFromText(
'LINESTRING( 70 38, 84 42 )' ,101));
INSERT INTO road_segments VALUES(106, 'Dirt Road by Green Forest', NULL,
1,
LineFromText(
'LINESTRING( 28 26, 28 0 )',101));
# DividedRoutes
INSERT INTO divided_routes VALUES(119, 'Route 75', 4,
MLineFromText(
'MULTILINESTRING((10 48,10 21,10 0),
(16 0,16 23,16 48))', 101));
# Forests
INSERT INTO forests VALUES(109, 'Green Forest',
MPolyFromText(
'MULTIPOLYGON(((28 26,28 0,84 0,84 42,28 26),
(52 18,66 23,73 9,48 6,52 18)),((59 18,67 18,67 13,59 13,59 18)))',
101));
# Bridges
INSERT INTO bridges VALUES(110, 'Cam Bridge', PointFromText(
'POINT( 44 31 )', 101));
# Streams
INSERT INTO streams VALUES(111, 'Cam Stream',
LineFromText(
'LINESTRING( 38 48, 44 41, 41 36, 44 31, 52 18 )', 101));
INSERT INTO streams VALUES(112, NULL,
LineFromText(
'LINESTRING( 76 0, 78 4, 73 9 )', 101));
# Buildings
INSERT INTO buildings VALUES(113, '123 Main Street',
PointFromText(
'POINT( 52 30 )', 101),
PolyFromText(
'POLYGON( ( 50 31, 54 31, 54 29, 50 29, 50 31) )', 101));
INSERT INTO buildings VALUES(114, '215 Main Street',
PointFromText(
'POINT( 64 33 )', 101),
PolyFromText(
'POLYGON( ( 66 34, 62 34, 62 32, 66 32, 66 34) )', 101));
# Ponds
INSERT INTO ponds VALUES(120, NULL, 'Stock Pond',
MPolyFromText(
'MULTIPOLYGON( ( ( 24 44, 22 42, 24 40, 24 44) ),
( ( 26 44, 26 40, 28 42, 26 44) ) )', 101));
# Named Places
INSERT INTO named_places VALUES(117, 'Ashton',
PolyFromText(
'POLYGON( ( 62 48, 84 48, 84 30, 56 30, 56 34, 62 48) )', 101));
INSERT INTO named_places VALUES(118, 'Goose Island',
PolyFromText(
'POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )', 101));
# Map Neatlines
INSERT INTO map_neatlines VALUES(115,
PolyFromText(
'POLYGON( ( 0 0, 0 48, 84 48, 84 0, 0 0 ) )', 101));
#
# C.3.3.3 Geometry types and functions schema test queries
# Conformance Item T6
SELECT Dimension(shore)
FROM lakes
WHERE name = 'Blue Lake';
Dimension(shore)
2
# Conformance Item T7
SELECT GeometryType(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
GeometryType(centerlines)
MULTILINESTRING
# Conformance Item T8
SELECT AsText(boundary)
FROM named_places
WHERE name = 'Goose Island';
AsText(boundary)
POLYGON((67 13,67 18,59 18,59 13,67 13))
# Conformance Item T9
SELECT AsText(PolyFromWKB(AsBinary(boundary),101))
FROM named_places
WHERE name = 'Goose Island';
AsText(PolyFromWKB(AsBinary(boundary),101))
POLYGON((67 13,67 18,59 18,59 13,67 13))
# Conformance Item T10
SELECT SRID(boundary)
FROM named_places
WHERE name = 'Goose Island';
SRID(boundary)
101
# Conformance Item T11
SELECT IsEmpty(centerline)
FROM road_segments
WHERE name = 'Route 5'
AND aliases = 'Main Street';
IsEmpty(centerline)
0
# Conformance Item T12
SELECT IsSimple(shore)
FROM lakes
WHERE name = 'Blue Lake';
IsSimple(shore)
1
# Conformance Item T13
SELECT AsText(ST_Boundary(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(ST_Boundary(boundary))
LINESTRING(67 13,67 18,59 18,59 13,67 13)
# Conformance Item T14
SELECT AsText(Envelope(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(Envelope(boundary))
POLYGON((59 13,67 13,67 18,59 18,59 13))
# Conformance Item T15
SELECT X(position)
FROM bridges
WHERE name = 'Cam Bridge';
X(position)
44
# Conformance Item T16
SELECT Y(position)
FROM bridges
WHERE name = 'Cam Bridge';
Y(position)
31
# Conformance Item T17
SELECT AsText(StartPoint(centerline))
FROM road_segments
WHERE fid = 102;
AsText(StartPoint(centerline))
POINT(0 18)
# Conformance Item T18
SELECT AsText(EndPoint(centerline))
FROM road_segments
WHERE fid = 102;
AsText(EndPoint(centerline))
POINT(44 31)
SELECT IsClosed(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
exp
1
# Conformance Item T20
SELECT IsRing(LineFromWKB(AsBinary(Boundary(boundary)),SRID(boundary))) as exp
FROM named_places
WHERE name = 'Goose Island';
exp
1
# Conformance Item T21
SELECT GLength(centerline)
FROM road_segments
WHERE fid = 106;
GLength(centerline)
26
# Conformance Item T22
SELECT NumPoints(centerline)
FROM road_segments
WHERE fid = 102;
NumPoints(centerline)
5
# Conformance Item T23
SELECT AsText(PointN(centerline, 1))
FROM road_segments
WHERE fid = 102;
AsText(PointN(centerline, 1))
POINT(0 18)
# Conformance Item T24
SELECT AsText(Centroid(boundary))
FROM named_places
WHERE name = 'Goose Island';
AsText(Centroid(boundary))
POINT(63 15.5)
SELECT ST_Contains(boundary, PointOnSurface(boundary))
FROM named_places
WHERE name = 'Goose Island';
ST_Contains(boundary, PointOnSurface(boundary))
1
# Conformance Item T26
SELECT Area(boundary)
FROM named_places
WHERE name = 'Goose Island';
Area(boundary)
40
# Conformance Item T27
SELECT AsText(ExteriorRing(shore))
FROM lakes
WHERE name = 'Blue Lake';
AsText(ExteriorRing(shore))
LINESTRING(52 18,66 23,73 9,48 6,52 18)
# Conformance Item T28
SELECT NumInteriorRings(shore)
FROM lakes
WHERE name = 'Blue Lake';
NumInteriorRings(shore)
1
# Conformance Item T29
SELECT AsText(InteriorRingN(shore, 1))
FROM lakes
WHERE name = 'Blue Lake';
AsText(InteriorRingN(shore, 1))
LINESTRING(59 18,67 18,67 13,59 13,59 18)
# Conformance Item T30
SELECT NumGeometries(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
NumGeometries(centerlines)
2
# Conformance Item T31
SELECT AsText(GeometryN(centerlines, 2))
FROM divided_routes
WHERE name = 'Route 75';
AsText(GeometryN(centerlines, 2))
LINESTRING(16 0,16 23,16 48)
# Conformance Item T32
SELECT IsClosed(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
IsClosed(centerlines)
0
# Conformance Item T33
SELECT GLength(centerlines)
FROM divided_routes
WHERE name = 'Route 75';
GLength(centerlines)
96
# Conformance Item T34
SELECT AsText(Centroid(shores))
FROM ponds
WHERE fid = 120;
AsText(Centroid(shores))
POINT(25 42)
# Conformance Item T35
SELECT Contains(shores, PointOnSurface(shores))
FROM ponds
WHERE fid = 120;
Contains(shores, PointOnSurface(shores))
1
# Conformance Item T36
SELECT Area(shores)
FROM ponds
WHERE fid = 120;
Area(shores)
8
# Conformance Item T37
SELECT ST_Equals(boundary,
PolyFromText('POLYGON( ( 67 13, 67 18, 59 18, 59 13, 67 13) )',1)) as exp
FROM named_places
WHERE name = 'Goose Island';
exp
1
# Conformance Item T38
SELECT ST_Disjoint(centerlines, boundary)
FROM divided_routes, named_places
WHERE divided_routes.name = 'Route 75'
AND named_places.name = 'Ashton';
ST_Disjoint(centerlines, boundary)
1
# Conformance Item T39
SELECT ST_Touches(centerline, shore)
FROM streams, lakes
WHERE streams.name = 'Cam Stream'
AND lakes.name = 'Blue Lake';
ST_Touches(centerline, shore)
1
# Conformance Item T40
SELECT ST_Within(footprint, boundary)
FROM named_places, buildings
WHERE named_places.name = 'Ashton'
AND buildings.address = '215 Main Street';
ST_Within(footprint, boundary)
1
# Conformance Item T41
SELECT ST_Overlaps(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Overlaps(forests.boundary, named_places.boundary)
1
# Conformance Item T42
SELECT Crosses(road_segments.centerline, divided_routes.centerlines)
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
Crosses(road_segments.centerline, divided_routes.centerlines)
1
# Conformance Item T43
SELECT ST_Intersects(road_segments.centerline, divided_routes.centerlines) as exp
FROM road_segments, divided_routes
WHERE road_segments.fid = 102
AND divided_routes.name = 'Route 75';
exp
1
# Conformance Item T44
SELECT ST_Contains(forests.boundary, named_places.boundary)
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Contains(forests.boundary, named_places.boundary)
0
# Conformance Item T45
SELECT ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
FROM forests, named_places
WHERE forests.name = 'Green Forest'
AND named_places.name = 'Ashton';
ST_Relate(forests.boundary, named_places.boundary, 'TTTTTTTTT')
1
# Conformance Item T46
SELECT ST_Distance(position, boundary)
FROM bridges, named_places
WHERE bridges.name = 'Cam Bridge'
AND named_places.name = 'Ashton';
ST_Distance(position, boundary)
12
# Conformance Item T47
SELECT AsText(ST_Intersection(centerline, shore))
FROM streams, lakes
WHERE streams.name = 'Cam Stream'
AND lakes.name = 'Blue Lake';
AsText(ST_Intersection(centerline, shore))
POINT(52 18)
# Conformance Item T48
SELECT AsText(ST_Difference(named_places.boundary, forests.boundary))
FROM named_places, forests
WHERE named_places.name = 'Ashton'
AND forests.name = 'Green Forest';
AsText(ST_Difference(named_places.boundary, forests.boundary))
POLYGON((56 34,62 48,84 48,84 42,56 34))
SELECT AsText(ST_Union(shore, boundary))
FROM lakes, named_places
WHERE lakes.name = 'Blue Lake'
AND named_places.name = 'Goose Island';
AsText(ST_Union(shore, boundary))
POLYGON((48 6,52 18,66 23,73 9,48 6))
# Conformance Item T50
SELECT AsText(ST_SymDifference(shore, boundary))
FROM lakes, named_places
WHERE lakes.name = 'Blue Lake'
AND named_places.name = 'Ashton';
AsText(ST_SymDifference(shore, boundary))
MULTIPOLYGON(((48 6,52 18,66 23,73 9,48 6),(59 13,59 18,67 18,67 13,59 13)),((56 30,56 34,62 48,84 48,84 30,56 30)))
# Conformance Item T51
SELECT count(*)
FROM buildings, bridges
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
count(*)
1
# Conformance Item T52
SELECT AsText(ConvexHull(shore))
FROM lakes
WHERE lakes.name = 'Blue Lake';
AsText(ConvexHull(shore))
POLYGON((48 6,52 18,66 23,73 9,48 6))
DROP DATABASE gis_ogs;
USE test;
#
# BUG #1043845 st_distance() results are incorrect depending on variable order
#
select st_distance(geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193)'),
geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)')) as exp ;
exp
0.008148695928146028
select st_distance(geomfromtext('point(-95.96269500000000000000 36.14181833333330000000)'),
geomfromtext('LINESTRING(-95.9673005697771 36.13509598461,
-95.9673057475387 36.1344478941074,
-95.9673063519371 36.134484524621,
-95.9673049102515 36.1343976584193) ')) as exp ;
exp
0.008148695928146028
#
# MDEV-4310 geometry function equals hangs forever.
#
create table t1(a geometry not null)engine=myisam;
insert into t1 values(geomfromtext("POINT(0 0)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
insert into t1 values(geomfromtext("POINT(0 9.2233720368548e18)"));
select equals(`a`,convert(`a` using utf8)) from `t1`;
ERROR HY000: Illegal parameter data type longblob for operation 'st_equals'
select equals(`a`,left(`a`,23)) from `t1`;
equals(`a`,left(`a`,23))
NULL
NULL
NULL
drop table t1;
#
# MDEV-6883 ST_WITHIN crashes server if (0,0) is matched to POLYGON((0 0))
#
select st_within(GeomFromText('Polygon((0 0))'), Point(0,0));
st_within(GeomFromText('Polygon((0 0))'), Point(0,0))
1
End of 5.3 tests
#
# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE
#
CREATE TABLE g1
(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam;
INSERT INTO g1 VALUES (geomfromtext('point(1 1)'));
INSERT INTO g1 VALUES (geomfromtext('point(1 2)'));
FLUSH TABLES;
SELECT 1 FROM g1
FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month)
;
ERROR HY000: Illegal parameter data types geometry and datetime for operation '='
DROP TABLE g1;
#
# Bug#13013970 MORE CRASHES IN FIELD_BLOB::GET_KEY_IMAGE
#
CREATE TABLE g1(a TEXT NOT NULL, KEY(a(250)));
INSERT INTO g1 VALUES ('a'),('a');
SELECT 1 FROM g1 WHERE a >= ANY
(SELECT 1 FROM g1 WHERE a = geomfromtext('') OR a) ;
1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'a'
Warning 1292 Truncated incorrect DECIMAL value: 'a'
DROP TABLE g1;
#
# Bug#16451878 GEOMETRY QUERY CRASHES SERVER
#
# should not crash
SELECT ASTEXT(0x0100000000030000000100000000000010);
ASTEXT(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT ENVELOPE(0x0100000000030000000100000000000010);
ENVELOPE(0x0100000000030000000100000000000010)
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffff0000, 1) as exp;
exp
NULL
#should not crash
SELECT
GEOMETRYN(0x0100000000070000000100000001030000000200000000000000ffffff0f, 1) as exp;
exp
NULL
#
# MDEV-3819 missing constraints for spatial column types
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) as exp;
exp
GEOMETRYCOLLECTION EMPTY
CREATE VIEW v1 AS SELECT POINT(1,1) AS p;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select point(1,1) AS `p` latin1 latin1_swedish_ci
SELECT ASTEXT(p) FROM v1;
ASTEXT(p)
POINT(1 1)
DROP VIEW v1;
#
# Start of 10.0 tests
#
#
# MDEV-12495 Conditional jump depends on uninitialised value for: SELECT NULL UNION geom_expression
#
SELECT AsText(g) FROM (SELECT NULL AS g UNION SELECT Point(1,1)) AS t1;
AsText(g)
NULL
POINT(1 1)
#
# MDEV-10306 Wrong results with combination of CONCAT, SUBSTR and CONVERT in subquery
#
SET @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='derived_merge=on';
CREATE TABLE t1 (x INT, y INT);
INSERT INTO t1 VALUES(0,0);
SELECT LENGTH(t2) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
c2
25
SELECT LENGTH(CONCAT(t2,'-',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
c2
51
SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FROM t1) sub;
c2
52
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with
# optimizer_use_condition_selectivity>=3
#
CREATE TABLE t1 (a POINT);
INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
set @save_use_stat_tables= @@use_stat_tables;
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
set @@use_stat_tables= PREFERABLY;
set @@optimizer_use_condition_selectivity=3;
SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
COUNT(*)
0
set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
drop table t1;
#
# End 10.0 tests
#
SHOW CREATE TABLE information_schema.geometry_columns;
Table Create Table
GEOMETRY_COLUMNS CREATE TEMPORARY TABLE `GEOMETRY_COLUMNS` (
`F_TABLE_CATALOG` varchar(512) NOT NULL,
`F_TABLE_SCHEMA` varchar(64) NOT NULL,
`F_TABLE_NAME` varchar(64) NOT NULL,
`F_GEOMETRY_COLUMN` varchar(64) NOT NULL,
`G_TABLE_CATALOG` varchar(512) NOT NULL,
`G_TABLE_SCHEMA` varchar(64) NOT NULL,
`G_TABLE_NAME` varchar(64) NOT NULL,
`G_GEOMETRY_COLUMN` varchar(64) NOT NULL,
`STORAGE_TYPE` tinyint(2) NOT NULL,
`GEOMETRY_TYPE` int(7) NOT NULL,
`COORD_DIMENSION` tinyint(2) NOT NULL,
`MAX_PPR` tinyint(2) NOT NULL,
`SRID` smallint(5) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
SHOW CREATE TABLE information_schema.spatial_ref_sys;
Table Create Table
SPATIAL_REF_SYS CREATE TEMPORARY TABLE `SPATIAL_REF_SYS` (
`SRID` smallint(5) NOT NULL,
`AUTH_NAME` varchar(512) NOT NULL,
`AUTH_SRID` int(5) NOT NULL,
`SRTEXT` varchar(2048) NOT NULL
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
create table t1(g GEOMETRY, pt POINT);
create table t2(g LINESTRING, pl POLYGON);
select * from information_schema.geometry_columns where f_table_schema='test';
F_TABLE_CATALOG F_TABLE_SCHEMA F_TABLE_NAME F_GEOMETRY_COLUMN G_TABLE_CATALOG G_TABLE_SCHEMA G_TABLE_NAME G_GEOMETRY_COLUMN STORAGE_TYPE GEOMETRY_TYPE COORD_DIMENSION MAX_PPR SRID
def test t1 def test t1 g 1 0 2 0 0
def test t1 def test t1 pt 1 1 2 0 0
def test t2 def test t2 g 1 2 2 0 0
def test t2 def test t2 pl 1 3 2 0 0
drop table t1, t2;
10.1 tests
create table t1(g GEOMETRY(9,4) REF_SYSTEM_ID=101, pt POINT(8,2), pg GEOMETRY REF_SYSTEM_ID=102);
SELECT SRID from information_schema.geometry_columns WHERE f_table_schema='test' and G_TABLE_NAME='t1';
SRID
101
0
102
drop table t1;
# Expect an int(1) column to be created
CREATE TABLE t1 AS SELECT CONTAINS(NULL, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CONTAINS(NULL, NULL)` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
#
# MDEV-7334 valgrind warning "unitialized bytes" in 10.1.
#
CREATE TABLE t1 (
gp point,
ln linestring,
pg polygon,
mp multipoint,
mln multilinestring,
mpg multipolygon,
gc geometrycollection,
gm geometry
);
ALTER TABLE t1 ADD fid INT NOT NULL;
select SRID from information_schema.geometry_columns where F_TABLE_NAME='t1';
SRID
0
0
0
0
0
0
0
0
drop table t1;
#
# MDEV-7510 GIS: IsRing returns false for a primitive triangle.
#
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'));
ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,0 0)'))
1
select ST_IsRing(ST_LineFromText('LINESTRING(0 0,0 10,10 10,-10 -10, 0 -10, 0 0)')) as exp;
exp
0
#
# MDEV-7514 GIS: PointOnSurface returns NULL instead of the point.
#
SELECT ST_GEOMETRYTYPE(ST_PointOnSurface(ST_PolyFromText('POLYGON((-70.916 42.1002,-70.9468 42.0946,-70.9754 42.0875,-70.9749 42.0879,-70.9759 42.0897,-70.916 42.1002))'))) as exp;
exp
NULL
#
# MDEV-7529 GIS: ST_Relate returns unexpected results for POINT relations
#
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**FFF*') AS equals;
equals
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*****FF*') AS contains;
contains
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'T*F**F***') AS within;
within
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(1 1)'),'FF*FF****') as disjoint;
disjoint
1
select ST_Relate(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'),'FF*FF****') as disjoint;
disjoint
0
#
# MDEV-7528 GIS: Functions return NULL instead of specified -1 for NULL arguments.
#
select ST_IsRing(NULL);
ST_IsRing(NULL)
-1
#
# MDEV-8675 Different results of GIS functions on NULL vs NOT NULL columns
#
CREATE TABLE t1 (g1 GEOMETRY NOT NULL,g2 GEOMETRY NULL);
CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`w1` int(1) DEFAULT NULL,
`w2` int(1) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1,t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
point_data POINT NOT NULL,
PRIMARY KEY (id),
KEY idx_point_data(point_data)
) ENGINE=MyISAM;
INSERT t1 (point_data) VALUES
(GeomFromText('Point(37.0248492 23.8512726)')),
(GeomFromText('Point(38.0248492 23.8512726)'));
SELECT id FROM t1
WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)'));
id
2
DROP TABLE t1;
#
# Start of 10.2 tests
#
create view v1 as select AsWKT(GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9))));
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select st_astext(geometrycollection(point(44,6),linestring(point(3,6),point(7,9)))) AS `Name_exp_1` latin1 latin1_swedish_ci
select * from v1;
Name_exp_1
GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
drop view v1;
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a POINT, x DOUBLE DEFAULT x(a), y DOUBLE DEFAULT y(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` point DEFAULT NULL,
`x` double DEFAULT st_x(`a`),
`y` double DEFAULT st_y(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Point(1,2));
SELECT x,y FROM t1;
x y
1 2
DROP TABLE t1;
CREATE TABLE t1 (g GEOMETRY, area DOUBLE DEFAULT ST_AREA(g));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometry DEFAULT NULL,
`area` double DEFAULT st_area(`g`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (g) VALUES (GeomFromText('POLYGON((0 0,20 0,20 20,0 20,0 0))'));
SELECT area FROM t1;
area
400
DROP TABLE t1;
CREATE TABLE t1 (g GEOMETRY, length DOUBLE DEFAULT ST_LENGTH(g));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometry DEFAULT NULL,
`length` double DEFAULT st_length(`g`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (g) VALUES (GeomFromText('LINESTRING(0 0,20 0,20 20,0 20,0 0)'));
SELECT length FROM t1;
length
80
DROP TABLE t1;
CREATE TABLE t1 (g POINT, distance DOUBLE DEFAULT ST_DISTANCE(g, POINT(0,0)));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` point DEFAULT NULL,
`distance` double DEFAULT st_distance(`g`,point(0,0))
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (g) VALUES (Point(1,0));
SELECT distance FROM t1;
distance
1
DROP TABLE t1;
CREATE TABLE t1 (a TEXT, g GEOMETRY DEFAULT GeomFromText(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text DEFAULT NULL,
`g` geometry DEFAULT st_geometryfromtext(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES ('point(1 1)');
SELECT AsText(g) FROM t1;
AsText(g)
POINT(1 1)
DROP TABLE t1;
CREATE TABLE t1 (x INT, y INT, g GEOMETRY DEFAULT POINT(x,y));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`g` geometry DEFAULT point(`x`,`y`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (x,y) VALUES (10,20);
SELECT AsText(g) FROM t1;
AsText(g)
POINT(10 20)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointN(a,2));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_pointn(`a`,2)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(2 2)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT StartPoint(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_startpoint(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,2 2,3 3)'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(1 1)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c GEOMETRY DEFAULT GeometryCollection(a,b));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT NULL,
`c` geometry DEFAULT geometrycollection(`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a,b) VALUES (Point(1,1), Point(2,2));
SELECT AsText(c) FROM t1;
AsText(c)
GEOMETRYCOLLECTION(POINT(1 1),POINT(2 2))
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT GeomFromWKB(AsBinary(a),20));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_geometryfromwkb(st_aswkb(`a`),20)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('POINT(1 1)', 10));
SELECT AsText(a), SRID(a), AsText(b), SRID(b) FROM t1;
AsText(a) SRID(a) AsText(b) SRID(b)
POINT(1 1) 10 POINT(1 1) 20
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BOUNDARY(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_boundary(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
AsText(b)
LINESTRING(10 10,10 20,20 20,20 10,10 10)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT BUFFER(a,10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_buffer(`a`,10)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
GeometryType(b)
POLYGON
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT CENTROID(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_centroid(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT AsText(b) FROM t1;
AsText(b)
POINT(15 15)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT ENVELOPE(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_envelope(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(1 1,4 4)'));
SELECT AsText(b) FROM t1;
AsText(b)
POLYGON((1 1,4 1,4 4,1 4,1 1))
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT PointOnSurface(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT st_pointonsurface(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('POLYGON((10 10, 10 20, 20 20, 20 10, 10 10))'));
SELECT GeometryType(b) FROM t1;
GeometryType(b)
POINT
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY DEFAULT Point(1,1), c GEOMETRY DEFAULT ST_UNION(a,b));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT point(1,1),
`c` geometry DEFAULT st_union(`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Point(0,0));
SELECT AsText(c) FROM t1;
AsText(c)
MULTIPOINT(0 0,1 1)
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b VARCHAR(20) DEFAULT GeometryType(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` varchar(20) DEFAULT st_geometrytype(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
POINT
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsSimple(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_issimple(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsEmpty(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_isempty(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Point(0, 0));
SELECT b FROM t1;
b
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsRing(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_isring(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT IsClosed(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_isclosed(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('LineString(0 0,0 1,1 1,1 0,0 0)'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT Dimension(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_dimension(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (Buffer(Point(1,1),1));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumGeometries(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_numgeometries(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (ST_UNION(Point(1,1),Point(0,0)));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumInteriorRings(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_numinteriorrings(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('Polygon((0 0,0 3,3 3,3 0,0 0),(1 1,1 2,2 2,2 1,1 1))'));
SELECT b FROM t1;
b
1
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT NumPoints(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT st_numpoints(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (LineString(Point(1,1),Point(0,0)));
SELECT b FROM t1;
b
2
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b INT DEFAULT SRID(a));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` int(11) DEFAULT srid(`a`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a) VALUES (GeomFromText('Point(1 1)', 100));
SELECT b FROM t1;
b
100
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT MBRDisjoint(a,b));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT NULL,
`c` int(11) DEFAULT mbrdisjoint(`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Disjoint(a,b));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT NULL,
`c` int(11) DEFAULT st_disjoint(`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
0
DROP TABLE t1;
CREATE TABLE t1 (a GEOMETRY, b GEOMETRY, c INT DEFAULT ST_Relate(a,b,'T*F**FFF*'));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` geometry DEFAULT NULL,
`b` geometry DEFAULT NULL,
`c` int(11) DEFAULT st_relate(`a`,`b`,'T*F**FFF*')
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1));
SELECT c FROM t1;
c
1
DROP TABLE t1;
create table t1 (p point default "qwer");
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
create table t1 (p point default 0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
create table t1 (p point not null default st_geometryfromtext('point 0)'));
ERROR 42000: Invalid default value for 'p'
create table t1 (p point not null default st_geometryfromtext('point(0 0)'));
insert into t1 values(default);
select st_astext(p) from t1;
st_astext(p)
POINT(0 0)
drop table t1;
#
# MDEV-21056 Memory leak after query with DEFAULT on a geometry field
#
CREATE TABLE t1 (f POINT DEFAULT ST_GEOMFROMTEXT('Point(0 0)'));
SELECT ST_GEOMFROMTEXT('Point(1 1)') IN ( DEFAULT( `f` ), ST_GEOMFROMTEXT('Point(2 2)') ) AS x FROM t1;
x
DROP TABLE t1;
#
# End of 10.2 tests
#
#
# MDEV-11478 Result data type aggregation for pluggable data types
#
CREATE PROCEDURE p2(query TEXT)
BEGIN
DECLARE errcount INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
SET errcount = errcount+1;
#SHOW WARNINGS;
GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
SELECT @p AS `ERROR: `;
END;
SELECT query AS ``;
EXECUTE IMMEDIATE query;
IF errcount = 0
THEN
SHOW CREATE TABLE t2;
DROP TABLE t2;
END IF;
END;
$$
CREATE PROCEDURE p1(query TEXT)
BEGIN
SELECT query AS `-------------------------------------`;
EXECUTE IMMEDIATE query;
CALL p2('CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1');
CALL p2('CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1');
CALL p2('CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1');
CALL p2('CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1');
CALL p2('CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1');
DROP TABLE t1;
END;
$$
-------------------------------------
CREATE TABLE t1 (a CHAR(10), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a VARCHAR(10), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TINYTEXT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TEXT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a MEDIUMTEXT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a LONGTEXT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`a` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TINYINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a INT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types int and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types int and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types float and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types float and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types double and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types double and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a TIME, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types time and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types time and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DATE, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types date and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types date and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
ERROR:
Illegal parameter data types year and point for operation 'case'
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'coalesce'
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'if'
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'ifnull'
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types year and point for operation 'UNION'
# This creates BLOB with hybrid functions, but fails on error with UNION (MDEV-11458)
-------------------------------------
CREATE TABLE t1 (a ENUM(0x61), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types enum and point for operation 'UNION'
-------------------------------------
CREATE TABLE t1 (a SET(0x61), b Point)
CREATE TABLE t2 AS SELECT CASE WHEN TRUE THEN a ELSE b END FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`CASE WHEN TRUE THEN a ELSE b END` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT COALESCE(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IF(TRUE,a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IF(TRUE,a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT IFNULL(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`IFNULL(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t2 AS SELECT a FROM t1 UNION SELECT b FROM t1
ERROR:
Illegal parameter data types set and point for operation 'UNION'
CREATE TABLE t1 AS SELECT COALESCE(NULL, Point(1,1));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(NULL, Point(1,1))` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 AS SELECT NULL UNION SELECT Point(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`NULL` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
#
# MDEV-11692 Comparison data type aggregation for pluggable data types
#
CREATE PROCEDURE p2(query TEXT)
BEGIN
DECLARE errcount INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
SET errcount = errcount+1;
GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
SELECT @p AS `ERROR: `;
END;
SELECT query AS ``;
EXECUTE IMMEDIATE query;
END;
$$
CREATE PROCEDURE p1(query TEXT)
BEGIN
SELECT query AS `-------------------------------------`;
EXECUTE IMMEDIATE query;
CALL p2('SELECT a=b FROM t1');
CALL p2('SELECT b=a FROM t1');
CALL p2('SELECT a BETWEEN b AND c FROM t1');
CALL p2('SELECT a IN (b,c) FROM t1');
CALL p2('SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1');
CALL p2('SELECT a=POINT(1,1) FROM t1');
CALL p2('SELECT POINT(1,1)=a FROM t1');
CALL p2('SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1');
CALL p2('SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1');
CALL p2('SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1');
DROP TABLE t1;
END;
$$
CALL p1('CREATE TABLE t1 (a CHAR(10), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a CHAR(10), b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a VARCHAR(10), b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a TINYTEXT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TINYTEXT, b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a TEXT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TEXT, b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a MEDIUMTEXT, b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a LONGTEXT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a LONGTEXT, b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a ENUM("a","b"), b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
CALL p1('CREATE TABLE t1 (a TINYINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TINYINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and tinyint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and tinyint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a SMALLINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types smallint and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and smallint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and smallint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and mediumint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and mediumint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a INT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a INT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types int and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and int for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types int and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types int and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types int and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and int for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types int and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a BIGINT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types bigint and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and bigint for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and bigint for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a FLOAT, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types float and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and float for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types float and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types float and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types float and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and float for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types float and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DOUBLE, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types double and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and double for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types double and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types double and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types double and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and double for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types double and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types decimal and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and decimal for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and decimal for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a BIT(8), b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types bit and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and bit for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types bit and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and bit for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a TIME, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TIME, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types time and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and time for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types time and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types time and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types time and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and time for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types time and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DATE, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DATE, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types date and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and date for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types date and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types date and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types date and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and date for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types date and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a DATETIME, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types datetime and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and datetime for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and datetime for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and timestamp for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and timestamp for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a YEAR, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point, c Point)
SELECT a=b FROM t1
ERROR:
Illegal parameter data types year and point for operation '='
SELECT b=a FROM t1
ERROR:
Illegal parameter data types point and year for operation '='
SELECT a BETWEEN b AND c FROM t1
ERROR:
Illegal parameter data types year and point for operation 'between'
SELECT a IN (b,c) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'in'
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
ERROR:
Illegal parameter data types year and point for operation 'case..when'
SELECT a=POINT(1,1) FROM t1
ERROR:
Illegal parameter data types year and point for operation '='
SELECT POINT(1,1)=a FROM t1
ERROR:
Illegal parameter data types point and year for operation '='
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'between'
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'in'
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
ERROR:
Illegal parameter data types year and point for operation 'case..when'
CALL p1('CREATE TABLE t1 (a Point, b Point, c Point)');
-------------------------------------
CREATE TABLE t1 (a Point, b Point, c Point)
SELECT a=b FROM t1
a=b
SELECT b=a FROM t1
b=a
SELECT a BETWEEN b AND c FROM t1
a BETWEEN b AND c
SELECT a IN (b,c) FROM t1
a IN (b,c)
SELECT CASE a WHEN b THEN "a" WHEN c THEN "b" END FROM t1
CASE a WHEN b THEN "a" WHEN c THEN "b" END
SELECT a=POINT(1,1) FROM t1
a=POINT(1,1)
SELECT POINT(1,1)=a FROM t1
POINT(1,1)=a
SELECT a BETWEEN POINT(1,1) AND POINT(1,2) FROM t1
a BETWEEN POINT(1,1) AND POINT(1,2)
SELECT a IN (POINT(1,1),POINT(1,2)) FROM t1
a IN (POINT(1,1),POINT(1,2))
SELECT CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END FROM t1
CASE a WHEN POINT(1,1) THEN "a" WHEN POINT(1,2) THEN "b" END
DROP PROCEDURE p1;
DROP PROCEDURE p2;
#
# MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler
#
CREATE PROCEDURE p2(query TEXT)
BEGIN
DECLARE errcount INT DEFAULT 0;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION
BEGIN
SET errcount = errcount+1;
#SHOW WARNINGS;
GET DIAGNOSTICS CONDITION 1 @p= MESSAGE_TEXT;
SELECT @p AS `ERROR: `;
END;
SELECT query AS ``;
EXECUTE IMMEDIATE query;
IF errcount = 0
THEN
SHOW CREATE TABLE t2;
DROP TABLE t2;
END IF;
END;
$$
CREATE PROCEDURE p1(query TEXT)
BEGIN
SELECT query AS `-------------------------------------`;
EXECUTE IMMEDIATE query;
CALL p2('CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1');
DROP TABLE t1;
END;
$$
-------------------------------------
CREATE TABLE t1 (a CHAR(10), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a VARCHAR(10), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TINYTEXT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TEXT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a MEDIUMTEXT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a LONGTEXT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a TINYINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types tinyint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a SMALLINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types smallint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a MEDIUMINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types mediumint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a INT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types int and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a BIGINT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types bigint and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a FLOAT, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types float and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DOUBLE, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types double and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DECIMAL(10,2), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types decimal and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a BIT(8), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types bit and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a TIME, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types time and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DATE, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types date and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a DATETIME, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types datetime and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a TIMESTAMP, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types timestamp and point for operation 'least'
-------------------------------------
CREATE TABLE t1 (a YEAR, b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
ERROR:
Illegal parameter data types year and point for operation 'least'
# This LEAST(ENUM,GEOMETRY) creates BLOB, but fails on error with UNION (see MDEV-12503)
-------------------------------------
CREATE TABLE t1 (a ENUM(0x61), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
-------------------------------------
CREATE TABLE t1 (a SET(0x61), b Point)
CREATE TABLE t2 AS SELECT LEAST(a,b) FROM t1
Table Create Table
t2 CREATE TABLE `t2` (
`LEAST(a,b)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CREATE TABLE t1 AS SELECT LEAST(NULL, Point(1,1));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`LEAST(NULL, Point(1,1))` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
#
# MDEV-12001 Split Item_func_round::fix_length_and_dec to virtual methods in Type_handler
#
CREATE TABLE t1 (a GEOMETRY);
SELECT ROUND(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'round'
DROP TABLE t1;
SELECT ROUND(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'round'
#
# MDEV-12199 Split Item_func_{abs|neg|int_val}::fix_length_and_dec() into methods in Type_handler
#
CREATE TABLE t1 (a GEOMETRY);
SELECT -a FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation '-'
SELECT ABS(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'abs'
SELECT CEILING(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
SELECT FLOOR(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
SELECT -COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation '-'
SELECT ABS(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'abs'
SELECT CEILING(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'ceiling'
SELECT FLOOR(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'floor'
DROP TABLE t1;
SELECT -POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '-'
SELECT ABS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'abs'
SELECT CEILING(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'ceiling'
SELECT FLOOR(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'floor'
#
# MDEV-12239 Add Type_handler::Item_sum_{sum|avg|variance}_fix_length_and_dec()
#
CREATE TABLE t1 (a GEOMETRY);
SELECT SUM(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'sum'
SELECT SUM(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT SUM(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'sum'
SELECT AVG(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'avg'
SELECT AVG(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT AVG(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'avg'
SELECT VARIANCE(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'variance('
SELECT VARIANCE(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT VARIANCE(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'variance('
SELECT STDDEV(POINT(1,1)) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'std('
SELECT STDDEV(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
SELECT STDDEV(COALESCE(a)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'std('
DROP TABLE t1;
#
# MDEV-12303 Add Type_handler::Item_xxx_fix_length_and_dec() for CAST classes
#
CREATE TABLE t1 (a GEOMETRY);
SELECT CAST(POINT(1,1) AS SIGNED) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_signed'
SELECT CAST(POINT(1,1) AS UNSIGNED) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_unsigned'
SELECT CAST(POINT(1,1) AS FLOAT) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'float_typecast'
SELECT CAST(POINT(1,1) AS DOUBLE) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'double_typecast'
SELECT CAST(POINT(1,1) AS DECIMAL(10,1)) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'decimal_typecast'
SELECT CAST(POINT(1,1) AS CHAR) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_char'
SELECT CAST(POINT(1,1) AS TIME) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_time'
SELECT CAST(POINT(1,1) AS DATE) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_date'
SELECT CAST(POINT(1,1) AS DATETIME) FROM t1;
ERROR HY000: Illegal parameter data type point for operation 'cast_as_datetime'
SELECT CAST(a AS SIGNED) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed'
SELECT CAST(a AS UNSIGNED) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned'
SELECT CAST(a AS FLOAT) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast'
SELECT CAST(a AS DOUBLE) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast'
SELECT CAST(a AS DECIMAL(10,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast'
SELECT CAST(a AS CHAR) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char'
SELECT CAST(a AS TIME) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time'
SELECT CAST(a AS DATE) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date'
SELECT CAST(a AS DATETIME) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime'
SELECT CAST(COALESCE(a) AS SIGNED) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_signed'
SELECT CAST(COALESCE(a) AS UNSIGNED) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_unsigned'
SELECT CAST(COALESCE(a) AS FLOAT) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'float_typecast'
SELECT CAST(COALESCE(a) AS DOUBLE) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'double_typecast'
SELECT CAST(COALESCE(a) AS DECIMAL(10,1)) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'decimal_typecast'
SELECT CAST(COALESCE(a) AS CHAR) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_char'
SELECT CAST(COALESCE(a) AS TIME) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_time'
SELECT CAST(COALESCE(a) AS DATE) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_date'
SELECT CAST(COALESCE(a) AS DATETIME) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'cast_as_datetime'
SELECT LENGTH(CAST(POINT(1,1) AS BINARY)) FROM t1;
LENGTH(CAST(POINT(1,1) AS BINARY))
SELECT LENGTH(CAST(a AS BINARY)) FROM t1;
LENGTH(CAST(a AS BINARY))
SELECT LENGTH(CAST(COALESCE(a) AS BINARY)) FROM t1;
LENGTH(CAST(COALESCE(a) AS BINARY))
DROP TABLE t1;
#
# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
#
CREATE TABLE t1 (a GEOMETRY);
SELECT POINT(1,1) + 1;
ERROR HY000: Illegal parameter data types point and int for operation '+'
SELECT POINT(1,1) - 1;
ERROR HY000: Illegal parameter data types point and int for operation '-'
SELECT POINT(1,1) * 1;
ERROR HY000: Illegal parameter data types point and int for operation '*'
SELECT POINT(1,1) / 1;
ERROR HY000: Illegal parameter data types point and int for operation '/'
SELECT POINT(1,1) MOD 1;
ERROR HY000: Illegal parameter data types point and int for operation 'MOD'
SELECT 1 + POINT(1,1);
ERROR HY000: Illegal parameter data types int and point for operation '+'
SELECT 1 - POINT(1,1);
ERROR HY000: Illegal parameter data types int and point for operation '-'
SELECT 1 * POINT(1,1);
ERROR HY000: Illegal parameter data types int and point for operation '*'
SELECT 1 / POINT(1,1);
ERROR HY000: Illegal parameter data types int and point for operation '/'
SELECT 1 MOD POINT(1,1);
ERROR HY000: Illegal parameter data types int and point for operation 'MOD'
SELECT a + 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT a - 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '-'
SELECT a * 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '*'
SELECT a / 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '/'
SELECT a MOD 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD'
SELECT 1 + a FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '+'
SELECT 1 - a FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '-'
SELECT 1 * a FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '*'
SELECT 1 / a FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '/'
SELECT 1 MOD a FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD'
SELECT COALESCE(a) + 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '+'
SELECT COALESCE(a) - 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '-'
SELECT COALESCE(a) * 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '*'
SELECT COALESCE(a) / 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation '/'
SELECT COALESCE(a) MOD 1 FROM t1;
ERROR HY000: Illegal parameter data types geometry and int for operation 'MOD'
SELECT 1 + COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '+'
SELECT 1 - COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '-'
SELECT 1 * COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '*'
SELECT 1 / COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation '/'
SELECT 1 MOD COALESCE(a) FROM t1;
ERROR HY000: Illegal parameter data types int and geometry for operation 'MOD'
DROP TABLE t1;
#
# MDEV-12514 Split Item_temporal_func::fix_length_and_dec()
#
SELECT DATE_ADD(POINT(1,1), INTERVAL 10 DAY);
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT DATE_SUB(POINT(1,1), INTERVAL 10 DAY);
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT POINT(1,1) + INTERVAL 10 DAY;
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT POINT(1,1) - INTERVAL 10 DAY;
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT INTERVAL 10 DAY + POINT(1,1);
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT INTERVAL 10 DAY + POINT(1,1);
ERROR HY000: Illegal parameter data types point and interval for operation 'date_add_interval'
SELECT ADDTIME(POINT(1,1), '10:10:10');
ERROR HY000: Illegal parameter data types point and varchar for operation 'addtime'
SELECT ADDTIME('10:10:10', POINT(1,1));
ERROR HY000: Illegal parameter data types varchar and point for operation 'addtime'
SELECT ADDTIME(POINT(1,1), TIME'10:10:10');
ERROR HY000: Illegal parameter data types point and time for operation 'addtime'
SELECT ADDTIME(TIME'10:10:10', POINT(1,1));
ERROR HY000: Illegal parameter data types time and point for operation 'addtime'
SELECT ADDTIME(POINT(1,1), TIMESTAMP'2001-01-01 10:10:10');
ERROR HY000: Illegal parameter data types point and datetime for operation 'addtime'
SELECT ADDTIME(TIMESTAMP'2001-01-01 10:10:10', POINT(1,1));
ERROR HY000: Illegal parameter data types datetime and point for operation 'addtime'
SELECT STR_TO_DATE(POINT(1,1),'%M %d,%Y');
ERROR HY000: Illegal parameter data types point and varchar for operation 'str_to_date'
SELECT STR_TO_DATE('2001-01-01', POINT(1,1));
ERROR HY000: Illegal parameter data types varchar and point for operation 'str_to_date'
#
# MDEV-12665 Hybrid functions do not preserve geometry type
#
CREATE TABLE t1 AS SELECT
Point(0,0) AS p0,
COALESCE(Point(0,0)) AS p1,
CASE WHEN 0 THEN Point(0,0) ELSE Point(1,1) END AS p2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`p0` point DEFAULT NULL,
`p1` point DEFAULT NULL,
`p2` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 AS SELECT LEAST(Point(0,0),Point(0,0)) AS p1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`p1` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE TABLE t1 (
c_geometry GEOMETRY,
c_point POINT,
c_linestring LINESTRING,
c_polygon POLYGON,
c_multipoint MULTIPOINT,
c_multilinestring MULTILINESTRING,
c_multipolygon MULTIPOLYGON,
c_geometrycollection GEOMETRYCOLLECTION
);
CREATE TABLE t2 AS SELECT
COALESCE(NULL, c_geometry),
COALESCE(NULL, c_point),
COALESCE(NULL, c_linestring),
COALESCE(NULL, c_polygon),
COALESCE(NULL, c_multipoint),
COALESCE(NULL, c_multilinestring),
COALESCE(NULL, c_multipolygon),
COALESCE(NULL, c_geometrycollection)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(NULL, c_geometry)` geometry DEFAULT NULL,
`COALESCE(NULL, c_point)` point DEFAULT NULL,
`COALESCE(NULL, c_linestring)` linestring DEFAULT NULL,
`COALESCE(NULL, c_polygon)` polygon DEFAULT NULL,
`COALESCE(NULL, c_multipoint)` multipoint DEFAULT NULL,
`COALESCE(NULL, c_multilinestring)` multilinestring DEFAULT NULL,
`COALESCE(NULL, c_multipolygon)` multipolygon DEFAULT NULL,
`COALESCE(NULL, c_geometrycollection)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
COALESCE(c_geometry, NULL),
COALESCE(c_point, NULL),
COALESCE(c_linestring, NULL),
COALESCE(c_polygon, NULL),
COALESCE(c_multipoint, NULL),
COALESCE(c_multilinestring, NULL),
COALESCE(c_multipolygon, NULL),
COALESCE(c_geometrycollection, NULL)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(c_geometry, NULL)` geometry DEFAULT NULL,
`COALESCE(c_point, NULL)` point DEFAULT NULL,
`COALESCE(c_linestring, NULL)` linestring DEFAULT NULL,
`COALESCE(c_polygon, NULL)` polygon DEFAULT NULL,
`COALESCE(c_multipoint, NULL)` multipoint DEFAULT NULL,
`COALESCE(c_multilinestring, NULL)` multilinestring DEFAULT NULL,
`COALESCE(c_multipolygon, NULL)` multipolygon DEFAULT NULL,
`COALESCE(c_geometrycollection, NULL)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t2;
CREATE TABLE t2 AS SELECT
COALESCE(c_geometry, c_geometry),
COALESCE(c_point, c_point),
COALESCE(c_linestring, c_linestring),
COALESCE(c_polygon, c_polygon),
COALESCE(c_multipoint, c_multipoint),
COALESCE(c_multilinestring, c_multilinestring),
COALESCE(c_multipolygon, c_multipolygon),
COALESCE(c_geometrycollection, c_geometrycollection)
FROM t1;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`COALESCE(c_geometry, c_geometry)` geometry DEFAULT NULL,
`COALESCE(c_point, c_point)` point DEFAULT NULL,
`COALESCE(c_linestring, c_linestring)` linestring DEFAULT NULL,
`COALESCE(c_polygon, c_polygon)` polygon DEFAULT NULL,
`COALESCE(c_multipoint, c_multipoint)` multipoint DEFAULT NULL,
`COALESCE(c_multilinestring, c_multilinestring)` multilinestring DEFAULT NULL,
`COALESCE(c_multipolygon, c_multipolygon)` multipolygon DEFAULT NULL,
`COALESCE(c_geometrycollection, c_geometrycollection)` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t2;
DROP TABLE t1;
#
# MDEV-12560 Wrong data type for SELECT NULL UNION SELECT Point(1,1)
#
CREATE TABLE t1 AS SELECT NULL AS c1 UNION SELECT POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
CREATE PROCEDURE p1(name TEXT)
BEGIN
EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a ', name, ')');
CREATE TABLE t2 AS
SELECT a AS a1, a AS a2, NULL AS a3 FROM t1 UNION
SELECT a AS a1, NULL AS a2, a AS a3 FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;
DROP TABLE t1;
END;
$$
CALL p1('geometry');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` geometry DEFAULT NULL,
`a2` geometry DEFAULT NULL,
`a3` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('point');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` point DEFAULT NULL,
`a2` point DEFAULT NULL,
`a3` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('linestring');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` linestring DEFAULT NULL,
`a2` linestring DEFAULT NULL,
`a3` linestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('polygon');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` polygon DEFAULT NULL,
`a2` polygon DEFAULT NULL,
`a3` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('multipoint');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multipoint DEFAULT NULL,
`a2` multipoint DEFAULT NULL,
`a3` multipoint DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('multilinestring');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multilinestring DEFAULT NULL,
`a2` multilinestring DEFAULT NULL,
`a3` multilinestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('multipolygon');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` multipolygon DEFAULT NULL,
`a2` multipolygon DEFAULT NULL,
`a3` multipolygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
CALL p1('geometrycollection');
Table Create Table
t2 CREATE TABLE `t2` (
`a1` geometrycollection DEFAULT NULL,
`a2` geometrycollection DEFAULT NULL,
`a3` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP PROCEDURE p1;
#
# MDEV-12798 Item_param does not preserve exact field type in EXECUTE IMMEDIATE 'CREATE TABLE AS SELECT ?' USING POINT(1,1)
#
EXECUTE IMMEDIATE 'CREATE TABLE t1 AS SELECT ?' USING POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`?` point NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
PREPARE stmt FROM 'CREATE OR REPLACE TABLE t1 AS SELECT ?';
EXECUTE stmt USING POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`?` point NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
#
# MDEV-12854 Synchronize CREATE..SELECT data type and result set metadata data type for INT functions
#
SELECT
ST_ISSIMPLE(POINT(1,1)),
ST_ISRING(POINT(1,1)),
ST_ISCLOSED(POINT(1,1)),
ST_DIMENSION(POINT(1,1)),
ST_NUMGEOMETRIES(POINT(1,1)),
ST_NUMINTERIORRINGS(POINT(1,1)),
ST_NUMPOINTS(POINT(1,1)),
ST_SRID(POINT(1,1));
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def ST_ISSIMPLE(POINT(1,1)) 3 2 1 Y 32896 0 63
def ST_ISRING(POINT(1,1)) 3 2 2 Y 32896 0 63
def ST_ISCLOSED(POINT(1,1)) 3 2 2 Y 32896 0 63
def ST_DIMENSION(POINT(1,1)) 3 10 1 Y 32896 0 63
def ST_NUMGEOMETRIES(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_NUMINTERIORRINGS(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_NUMPOINTS(POINT(1,1)) 3 10 0 Y 32896 0 63
def ST_SRID(POINT(1,1)) 3 10 1 Y 32896 0 63
ST_ISSIMPLE(POINT(1,1)) ST_ISRING(POINT(1,1)) ST_ISCLOSED(POINT(1,1)) ST_DIMENSION(POINT(1,1)) ST_NUMGEOMETRIES(POINT(1,1)) ST_NUMINTERIORRINGS(POINT(1,1)) ST_NUMPOINTS(POINT(1,1)) ST_SRID(POINT(1,1))
1 -1 -1 0 NULL NULL NULL 0
#
# MDEV-12803 Improve function parameter data type control
#
#
# Item_geometry_func_args_geometry
#
SELECT ST_CENTROID(1);
ERROR HY000: Illegal parameter data type int for operation 'st_centroid'
SELECT ST_ENVELOPE(1);
ERROR HY000: Illegal parameter data type int for operation 'st_envelope'
SELECT ST_BOUNDARY(1);
ERROR HY000: Illegal parameter data type int for operation 'st_boundary'
SELECT ST_STARTPOINT(1);
ERROR HY000: Illegal parameter data type int for operation 'st_startpoint'
SELECT ST_POINTONSURFACE(1);
ERROR HY000: Illegal parameter data type int for operation 'st_pointonsurface'
SELECT ST_POINTN(1,1);
ERROR HY000: Illegal parameter data type int for operation 'st_pointn'
SELECT ST_POINTN(LineString(Point(1,1)),Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_pointn'
SELECT ST_BUFFER(1, 1);
ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
SELECT ST_BUFFER(Point(1,1), Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_buffer'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_ENVELOPE(?) AS g';
EXECUTE stmt USING 1;
ERROR HY000: Illegal parameter data type int for operation 'st_envelope'
EXECUTE stmt USING POINT(1,1);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT ST_ASTEXT(g) FROM t1;
ST_ASTEXT(g)
POLYGON((1 1,1 1,1 1,1 1,1 1))
DROP TABLE t1;
DEALLOCATE PREPARE stmt;
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_BUFFER(?,?) AS g';
EXECUTE stmt USING 1,1;
ERROR HY000: Illegal parameter data type int for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation 'st_buffer'
EXECUTE stmt USING POINT(1,1),0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT ST_GEOMETRYTYPE(g) FROM t1;
ST_GEOMETRYTYPE(g)
POINT
DROP TABLE t1;
DEALLOCATE PREPARE stmt;
#
# Functions created GEOMETRY from non-GEOMETRY
#
SELECT ST_GEOMETRYFROMTEXT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT(Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT(Point(1,1), 1);
ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMTEXT('test', Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
SELECT ST_GEOMETRYFROMWKB(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(1);
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(1, 1);
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromwkb'
SELECT ST_GEOMETRYFROMWKB(Point(1,1), Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromwkb'
SELECT ST_GEOMFROMGEOJSON(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(1);
ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(1,1);
ERROR HY000: Illegal parameter data type int for operation 'st_geomfromgeojson'
SELECT ST_GEOMFROMGEOJSON(Point(1,1), Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_geomfromgeojson'
SELECT POINT(ROW(1,1),1);
ERROR HY000: Illegal parameter data type row for operation 'point'
SELECT POINT(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'point'
SELECT POINT(1,ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'point'
SELECT POINT(1,POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'point'
PREPARE stmt FROM 'CREATE TABLE t1 AS SELECT ST_GEOMFROMTEXT(?,?) AS g';
EXECUTE stmt USING 1,1;
ERROR HY000: Illegal parameter data type int for operation 'st_geometryfromtext'
EXECUTE stmt USING POINT(1,1),POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation 'st_geometryfromtext'
EXECUTE stmt USING 'POINT(1 1)',1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT ST_ASTEXT(g), SRID(g) FROM t1;
ST_ASTEXT(g) SRID(g)
POINT(1 1) 1
DROP TABLE t1;
DEALLOCATE PREPARE stmt;
# Item_func_spatial_collection
SELECT GEOMETRYCOLLECTION(ROW(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type row for operation 'geometrycollection'
SELECT GEOMETRYCOLLECTION(POINT(1,1), ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'geometrycollection'
SELECT GEOMETRYCOLLECTION(1, POINT(1,1));
ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
SELECT GEOMETRYCOLLECTION(POINT(1,1), 1);
ERROR HY000: Illegal parameter data type int for operation 'geometrycollection'
# Item_func_spatial_operation
SELECT ST_UNION(ROW(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_union'
SELECT ST_UNION(POINT(1,1), ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_union'
SELECT ST_UNION(1, POINT(1,1));
ERROR HY000: Illegal parameter data type int for operation 'st_union'
SELECT ST_UNION(POINT(1,1), 1);
ERROR HY000: Illegal parameter data type int for operation 'st_union'
# Item_binary_func_args_geometry
SELECT ST_ASWKB(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_aswkb'
SELECT ST_ASWKB(1);
ERROR HY000: Illegal parameter data type int for operation 'st_aswkb'
SELECT ST_ASWKB('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_aswkb'
# Item_real_func_args_geometry
SELECT ST_X(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_x'
SELECT ST_X(1);
ERROR HY000: Illegal parameter data type int for operation 'st_x'
SELECT ST_X('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_x'
SELECT ST_Y(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_y'
SELECT ST_Y(1);
ERROR HY000: Illegal parameter data type int for operation 'st_y'
SELECT ST_Y('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_y'
SELECT ST_AREA(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_area'
SELECT ST_AREA(1);
ERROR HY000: Illegal parameter data type int for operation 'st_area'
SELECT ST_AREA('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_area'
SELECT ST_LENGTH(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_length'
SELECT ST_LENGTH(1);
ERROR HY000: Illegal parameter data type int for operation 'st_length'
SELECT ST_LENGTH('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_length'
# Item_real_func_geometry_args_geometry_geometry
SELECT ST_DISTANCE(ROW(1,1), 1);
ERROR HY000: Illegal parameter data type row for operation 'st_distance'
SELECT ST_DISTANCE(1, 1);
ERROR HY000: Illegal parameter data type int for operation 'st_distance'
SELECT ST_DISTANCE('test', 1);
ERROR HY000: Illegal parameter data type varchar for operation 'st_distance'
SELECT ST_DISTANCE(POINT(1,1), ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_distance'
SELECT ST_DISTANCE(POINT(1,1), 1);
ERROR HY000: Illegal parameter data type int for operation 'st_distance'
SELECT ST_DISTANCE(POINT(1,1), 'test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_distance'
# Item_int_func_args_geometry
SELECT ST_ISSIMPLE(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_issimple'
SELECT ST_ISSIMPLE(1);
ERROR HY000: Illegal parameter data type int for operation 'st_issimple'
SELECT ST_ISSIMPLE('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_issimple'
SELECT ST_ISRING(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_isring'
SELECT ST_ISRING(1);
ERROR HY000: Illegal parameter data type int for operation 'st_isring'
SELECT ST_ISRING('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_isring'
SELECT ST_ISCLOSED(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_isclosed'
SELECT ST_ISCLOSED(1);
ERROR HY000: Illegal parameter data type int for operation 'st_isclosed'
SELECT ST_ISCLOSED('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_isclosed'
SELECT ST_DIMENSION(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_dimension'
SELECT ST_DIMENSION(1);
ERROR HY000: Illegal parameter data type int for operation 'st_dimension'
SELECT ST_DIMENSION('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_dimension'
SELECT ST_NUMGEOMETRIES(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_numgeometries'
SELECT ST_NUMGEOMETRIES(1);
ERROR HY000: Illegal parameter data type int for operation 'st_numgeometries'
SELECT ST_NUMGEOMETRIES('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_numgeometries'
SELECT ST_NUMINTERIORRINGS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_numinteriorrings'
SELECT ST_NUMINTERIORRINGS(1);
ERROR HY000: Illegal parameter data type int for operation 'st_numinteriorrings'
SELECT ST_NUMINTERIORRINGS('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_numinteriorrings'
SELECT ST_NUMPOINTS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_numpoints'
SELECT ST_NUMPOINTS(1);
ERROR HY000: Illegal parameter data type int for operation 'st_numpoints'
SELECT ST_NUMPOINTS('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_numpoints'
SELECT ST_SRID(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'srid'
SELECT ST_SRID(1);
ERROR HY000: Illegal parameter data type int for operation 'srid'
SELECT ST_SRID('test');
ERROR HY000: Illegal parameter data type varchar for operation 'srid'
# Item_bool_func_args_geometry
SELECT ST_ISEMPTY(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_isempty'
SELECT ST_ISEMPTY(1);
ERROR HY000: Illegal parameter data type int for operation 'st_isempty'
SELECT ST_ISEMPTY('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_isempty'
# Item_bool_func_geometry_args_geometry_geometry
SELECT ST_RELATE(ROW(1,1), POINT(1,1), 'T*F**FFF*');
ERROR HY000: Illegal parameter data type row for operation 'st_relate'
SELECT ST_RELATE(POINT(1,1), ROW(1,1), 'T*F**FFF*');
ERROR HY000: Illegal parameter data type row for operation 'st_relate'
SELECT ST_RELATE(1, POINT(1,1), 'T*F**FFF*');
ERROR HY000: Illegal parameter data type int for operation 'st_relate'
SELECT ST_RELATE(POINT(1,1), 1, 'T*F**FFF*');
ERROR HY000: Illegal parameter data type int for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),'T*F**FFF*') AS equals;
equals
1
SELECT ST_RELATE(Point(1,1),Point(1,1),NULL);
ST_RELATE(Point(1,1),Point(1,1),NULL)
NULL
SELECT ST_RELATE(Point(1,1),Point(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),1);
ERROR HY000: Illegal parameter data type int for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),1.0);
ERROR HY000: Illegal parameter data type decimal for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),1e0);
ERROR HY000: Illegal parameter data type double for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),TIME'10:10:10');
ERROR HY000: Illegal parameter data type time for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),DATE'2010-01-01');
ERROR HY000: Illegal parameter data type date for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),TIMESTAMP'2010-01-01 10:10:10');
ERROR HY000: Illegal parameter data type datetime for operation 'st_relate'
SELECT ST_RELATE(Point(1,1),Point(1,1),Point(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_relate'
# Item_str_ascii_func_args_geometry
SELECT ST_ASTEXT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_astext'
SELECT ST_ASTEXT(1);
ERROR HY000: Illegal parameter data type int for operation 'st_astext'
SELECT ST_ASTEXT('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_astext'
SELECT ST_GEOMETRYTYPE(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_geometrytype'
SELECT ST_GEOMETRYTYPE(1);
ERROR HY000: Illegal parameter data type int for operation 'st_geometrytype'
SELECT ST_GEOMETRYTYPE('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_geometrytype'
SELECT ST_ASGEOJSON(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_asgeojson'
SELECT ST_ASGEOJSON(1);
ERROR HY000: Illegal parameter data type int for operation 'st_asgeojson'
SELECT ST_ASGEOJSON('test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_asgeojson'
SELECT ST_ASGEOJSON(POINT(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_asgeojson'
SELECT ST_ASGEOJSON(POINT(1,1), 1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'st_asgeojson'
# Item_func_spatial_rel
SELECT ST_TOUCHES(ROW(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_touches'
SELECT ST_TOUCHES(POINT(1,1), ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_touches'
SELECT ST_TOUCHES(1, POINT(1,1));
ERROR HY000: Illegal parameter data type int for operation 'st_touches'
SELECT ST_TOUCHES(POINT(1,1), 1);
ERROR HY000: Illegal parameter data type int for operation 'st_touches'
SELECT ST_TOUCHES('test', POINT(1,1));
ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
SELECT ST_TOUCHES(POINT(1,1), 'test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
SELECT MBRTOUCHES(ROW(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_touches'
SELECT MBRTOUCHES(POINT(1,1), ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'st_touches'
SELECT MBRTOUCHES(1, POINT(1,1));
ERROR HY000: Illegal parameter data type int for operation 'st_touches'
SELECT MBRTOUCHES(POINT(1,1), 1);
ERROR HY000: Illegal parameter data type int for operation 'st_touches'
SELECT MBRTOUCHES('test', POINT(1,1));
ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
SELECT MBRTOUCHES(POINT(1,1), 'test');
ERROR HY000: Illegal parameter data type varchar for operation 'st_touches'
#
# MDEV-13964 Parameter data type control for Item_real_func
#
SELECT EXP(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'exp'
SELECT LN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'ln'
SELECT LOG2(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'log2'
SELECT LOG10(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'log10'
SELECT SQRT(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'sqrt'
SELECT ACOS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'acos'
SELECT ASIN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'asin'
SELECT COS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'cos'
SELECT SIN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'sin'
SELECT TAN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'tan'
SELECT COT(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'cot'
SELECT LOG(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT LOG(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT LOG(1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'log'
SELECT ATAN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT ATAN(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT ATAN(1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'atan'
SELECT POW(POINT(1,1),POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'pow'
SELECT RAND(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'rand'
SELECT RADIANS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'radians'
SELECT DEGREES(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'degrees'
SELECT EXP(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'exp'
SELECT LN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'ln'
SELECT LOG2(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log2'
SELECT LOG10(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log10'
SELECT SQRT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'sqrt'
SELECT ACOS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'acos'
SELECT ASIN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'asin'
SELECT COS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'cos'
SELECT SIN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'sin'
SELECT TAN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'tan'
SELECT COT(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'cot'
SELECT LOG(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT LOG(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT LOG(1, ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'log'
SELECT ATAN(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT ATAN(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT ATAN(1, ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'atan'
SELECT POW(ROW(1,1),ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'pow'
SELECT RAND(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'rand'
SELECT RADIANS(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'radians'
SELECT DEGREES(ROW(1,1));
ERROR HY000: Illegal parameter data type row for operation 'degrees'
#
# MDEV-13965 Parameter data type control for Item_longlong_func
#
SELECT POINT(1,1) | 1;
ERROR HY000: Illegal parameter data type point for operation '|'
SELECT 1 | POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '|'
SELECT POINT(1,1) & 1;
ERROR HY000: Illegal parameter data type point for operation '&'
SELECT 1 & POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '&'
SELECT POINT(1,1) << 1;
ERROR HY000: Illegal parameter data type point for operation '<<'
SELECT 1 << POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '<<'
SELECT POINT(1,1) >> 1;
ERROR HY000: Illegal parameter data type point for operation '>>'
SELECT 1 >> POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '>>'
SELECT ~POINT(1,1);
ERROR HY000: Illegal parameter data type point for operation '~'
SELECT TO_SECONDS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'to_seconds'
SELECT TIMESTAMPDIFF(SECOND,POINT(1,1), 1);
ERROR HY000: Illegal parameter data type point for operation 'timestampdiff'
SELECT TIMESTAMPDIFF(SECOND,1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'timestampdiff'
SELECT INET_ATON(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'inet_aton'
SELECT LAST_INSERT_ID(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'last_insert_id'
#
# MDEV-13966 Parameter data type control for Item_temporal_func
#
SELECT FROM_DAYS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'from_days'
SELECT MAKEDATE(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'makedate'
SELECT MAKEDATE(1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'makedate'
SELECT LAST_DAY(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'last_day'
SELECT SEC_TO_TIME(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'sec_to_time'
SELECT TIMEDIFF(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'timediff'
SELECT TIMEDIFF(1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'timediff'
SELECT MAKETIME(POINT(1,1),1,1);
ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT MAKETIME(1, POINT(1,1), 1);
ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT MAKETIME(1, 1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'maketime'
SELECT FROM_UNIXTIME(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'from_unixtime'
SELECT CONVERT_TZ(POINT(1,1),1,1);
ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
SELECT CONVERT_TZ(1, POINT(1,1), 1);
ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
SELECT CONVERT_TZ(1, 1, POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'convert_tz'
#
# MDEV-13967 Parameter data type control for Item_long_func
#
SELECT STRCMP(POINT(1,1),POINT(1,1));
STRCMP(POINT(1,1),POINT(1,1))
0
SELECT CHAR_LENGTH(POINT(1,1));
CHAR_LENGTH(POINT(1,1))
25
SELECT OCTET_LENGTH(POINT(1,1));
OCTET_LENGTH(POINT(1,1))
25
SELECT UNCOMPRESSED_LENGTH(POINT(1,1));
UNCOMPRESSED_LENGTH(POINT(1,1))
0
SELECT COERCIBILITY(POINT(1,1));
COERCIBILITY(POINT(1,1))
6
SELECT ASCII(POINT(1,1));
ASCII(POINT(1,1))
0
SELECT CRC32(POINT(1,1));
CRC32(POINT(1,1))
1349318989
SELECT ORD(POINT(1,1));
ORD(POINT(1,1))
0
SELECT SIGN(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'sign'
SELECT LOCATE('a','a',POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'locate'
SELECT LOCATE(POINT(1,1),POINT(1,1));
LOCATE(POINT(1,1),POINT(1,1))
1
SELECT BIT_COUNT(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'bit_count'
SELECT BENCHMARK(POINT(1,1),'');
ERROR HY000: Illegal parameter data type point for operation 'benchmark'
SELECT SLEEP(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'sleep'
SELECT GET_LOCK('x', POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'get_lock'
SELECT PERIOD_ADD(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'period_add'
SELECT PERIOD_ADD(1,POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'period_add'
SELECT PERIOD_DIFF(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'period_diff'
SELECT PERIOD_DIFF(1,POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'period_diff'
SELECT TO_DAYS(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'to_days'
SELECT DAYOFMONTH(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'dayofmonth'
SELECT DAYOFYEAR(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'dayofyear'
SELECT QUARTER(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'quarter'
SELECT YEAR(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'year'
SELECT YEARWEEK(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'yearweek'
SELECT WEEK(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT WEEK(POINT(1,1),1);
ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT WEEK(1,POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'week'
SELECT HOUR(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'hour'
SELECT MINUTE(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'minute'
SELECT SECOND(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'second'
SELECT MICROSECOND(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'microsecond'
SELECT JSON_DEPTH(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'json_depth'
SELECT JSON_LENGTH(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT JSON_LENGTH('json', POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT JSON_LENGTH(POINT(1,1), POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'json_length'
SELECT REGEXP_INSTR(POINT(1,1),'');
REGEXP_INSTR(POINT(1,1),'')
1
SELECT REGEXP_INSTR('',POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'regexp_instr'
SELECT FIND_IN_SET(POINT(1,1),'');
FIND_IN_SET(POINT(1,1),'')
0
SELECT FIND_IN_SET('',POINT(1,1));
FIND_IN_SET('',POINT(1,1))
0
SELECT RELEASE_LOCK(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'release_lock'
SELECT IS_FREE_LOCK(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'is_free_lock'
SELECT IS_USED_LOCK(POINT(1,1));
ERROR HY000: Illegal parameter data type point for operation 'is_used_lock'
#
# MDEV-26161 crash in Gis_point::calculate_haversine
#
select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
#
# End of 10.3 tests
#
#
# Start of 10.4 tests
#
#
# MDEV-16351 JSON_OBJECT() treats hybrid functions with boolean arguments as numbers
#
SELECT ST_SRID(TRUE);
ERROR HY000: Illegal parameter data type boolean for operation 'srid'
SELECT ST_SRID(COALESCE(TRUE,TRUE));
ERROR HY000: Illegal parameter data type boolean for operation 'srid'
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT ST_SRID((SELECT MAX(a)>3 FROM t1));
ERROR HY000: Illegal parameter data type boolean for operation 'srid'
SELECT ST_SRID(MAX(a>3)) FROM t1;
ERROR HY000: Illegal parameter data type boolean for operation 'srid'
SELECT ST_SRID((SELECT MAX(a>3) FROM t1));
ERROR HY000: Illegal parameter data type boolean for operation 'srid'
DROP TABLE t1;
#
# Mixing GEOMETRY with HEX hybrid
#
SELECT 0x60=POINT(1,1), POINT(1,1)=0x60;
0x60=POINT(1,1) POINT(1,1)=0x60
0 0
CREATE TABLE t1 AS SELECT
COALESCE(0x60,POINT(1,1)),
COALESCE(POINT(1,1),0x60),
LEAST(0x60,POINT(1,1)),
LEAST(POINT(1,1),0x60);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`COALESCE(0x60,POINT(1,1))` longblob NOT NULL,
`COALESCE(POINT(1,1),0x60)` longblob NOT NULL,
`LEAST(0x60,POINT(1,1))` longblob DEFAULT NULL,
`LEAST(POINT(1,1),0x60)` longblob DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1;
SELECT 0x60+POINT(1,1);
ERROR HY000: Illegal parameter data types bigint unsigned and point for operation '+'
SELECT POINT(1,1)+0x60;
ERROR HY000: Illegal parameter data types point and bigint unsigned for operation '+'
#
# MDEV-16454 Bad results for IN with ROW
#
SELECT (1,0) IN ((POINT(1,1),0),(0,0));
ERROR HY000: Illegal parameter data types int and point for operation 'in'
SELECT (1,(0,0)) IN ((1,(POINT(1,1),0)),(0,(0,0)));
ERROR HY000: Illegal parameter data types int and point for operation 'in'
#
# MDEV-19819 ALTER from POINT to LINESTRING erroneously preserves POINT values
#
CREATE TABLE t1 (a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (Point(0,0));
ALTER TABLE t1 MODIFY a LINESTRING;
ERROR 22007: Incorrect LINESTRING value: 'POINT(0 0)' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
CREATE TABLE t1 (a LINESTRING);
CREATE TABLE t2 (a POINT);
INSERT INTO t2 VALUES (POINT(0,0));
INSERT INTO t1 SELECT * FROM t2;
ERROR 22007: Incorrect LINESTRING value: 'POINT(0 0)' for column `test`.`t1`.`a` at row 1
SELECT AsText(a) FROM t1;
AsText(a)
DROP TABLE t1, t2;
#
# End of 10.4 tests
#
#
# Start of 10.5 tests
#
#
# MDEV-19994 Add class Function_collection
#
SELECT CONTAINS();
ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS()'
SELECT CONTAINS(POINT(1,1));
ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1))'
SELECT CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1));
ERROR 42000: Incorrect parameter count in the call to native function 'CONTAINS(POINT(1,1), POINT(1,1), POINT(1,1))'
SELECT WITHIN();
ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN()'
SELECT WITHIN(POINT(1,1));
ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1))'
SELECT WITHIN(POINT(1,1), POINT(1,1), POINT(1,1));
ERROR 42000: Incorrect parameter count in the call to native function 'WITHIN(POINT(1,1), POINT(1,1), POINT(1,1))'
#
# MDEV-20009 Add CAST(expr AS pluggable_type)
#
SELECT CAST(1 AS GEOMETRY);
ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)'
SELECT CAST(1 AS GEOMETRYCOLLECTION);
ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)'
SELECT CAST(1 AS POINT);
ERROR HY000: Operator does not exist: 'CAST(expr AS point)'
SELECT CAST(1 AS LINESTRING);
ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)'
SELECT CAST(1 AS POLYGON);
ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)'
SELECT CAST(1 AS MULTIPOINT);
ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)'
SELECT CAST(1 AS MULTILINESTRING);
ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)'
SELECT CAST(1 AS MULTIPOLYGON);
ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)'
SELECT CONVERT(1, GEOMETRY);
ERROR HY000: Operator does not exist: 'CAST(expr AS geometry)'
SELECT CONVERT(1, GEOMETRYCOLLECTION);
ERROR HY000: Operator does not exist: 'CAST(expr AS geometrycollection)'
SELECT CONVERT(1, POINT);
ERROR HY000: Operator does not exist: 'CAST(expr AS point)'
SELECT CONVERT(1, LINESTRING);
ERROR HY000: Operator does not exist: 'CAST(expr AS linestring)'
SELECT CONVERT(1, POLYGON);
ERROR HY000: Operator does not exist: 'CAST(expr AS polygon)'
SELECT CONVERT(1, MULTIPOINT);
ERROR HY000: Operator does not exist: 'CAST(expr AS multipoint)'
SELECT CONVERT(1, MULTILINESTRING);
ERROR HY000: Operator does not exist: 'CAST(expr AS multilinestring)'
SELECT CONVERT(1, MULTIPOLYGON);
ERROR HY000: Operator does not exist: 'CAST(expr AS multipolygon)'
#
# MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY
#
SET NAMES utf8;
CREATE TABLE t1 (
p POINT,
ls LINESTRING,
pl POLYGON,
mp MULTIPOINT,
mls MULTILINESTRING,
mpl MULTIPOLYGON,
gc GEOMETRYCOLLECTION,
g GEOMETRY
) CHARACTER SET utf8;
SELECT * FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 p p 255 (type=point) 4294967295 0 Y 144 0 63
def test t1 t1 ls ls 255 (type=linestring) 4294967295 0 Y 144 0 63
def test t1 t1 pl pl 255 (type=polygon) 4294967295 0 Y 144 0 63
def test t1 t1 mp mp 255 (type=multipoint) 4294967295 0 Y 144 0 63
def test t1 t1 mls mls 255 (type=multilinestring) 4294967295 0 Y 144 0 63
def test t1 t1 mpl mpl 255 (type=multipolygon) 4294967295 0 Y 144 0 63
def test t1 t1 gc gc 255 (type=geometrycollection) 4294967295 0 Y 144 0 63
def test t1 t1 g g 255 4294967295 0 Y 144 0 63
p ls pl mp mls mpl gc g
SELECT
COALESCE(p) AS p,
COALESCE(ls) AS ls,
COALESCE(pl) AS pl,
COALESCE(mp) AS mp,
COALESCE(mls) AS mls,
COALESCE(mpl) AS mpl,
COALESCE(gc) AS gc,
COALESCE(g) AS g
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def p 255 (type=point) 4294967295 0 Y 128 0 63
def ls 255 (type=linestring) 4294967295 0 Y 128 0 63
def pl 255 (type=polygon) 4294967295 0 Y 128 0 63
def mp 255 (type=multipoint) 4294967295 0 Y 128 0 63
def mls 255 (type=multilinestring) 4294967295 0 Y 128 0 63
def mpl 255 (type=multipolygon) 4294967295 0 Y 128 0 63
def gc 255 (type=geometrycollection) 4294967295 0 Y 128 0 63
def g 255 4294967295 0 Y 128 0 63
p ls pl mp mls mpl gc g
SELECT
COALESCE(p,p),
COALESCE(p,ls),
COALESCE(p,pl),
COALESCE(p,mp),
COALESCE(p,mls),
COALESCE(p,mpl),
COALESCE(p,g),
COALESCE(p,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(p,p) 255 (type=point) 4294967295 0 Y 128 0 63
def COALESCE(p,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(p,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(p,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(p,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(p,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(p,g) 255 4294967295 0 Y 128 0 63
def COALESCE(p,gc) 255 4294967295 0 Y 128 0 63
COALESCE(p,p) COALESCE(p,ls) COALESCE(p,pl) COALESCE(p,mp) COALESCE(p,mls) COALESCE(p,mpl) COALESCE(p,g) COALESCE(p,gc)
SELECT
COALESCE(ls,p),
COALESCE(ls,ls),
COALESCE(ls,pl),
COALESCE(ls,mp),
COALESCE(ls,mls),
COALESCE(ls,mpl),
COALESCE(ls,g),
COALESCE(ls,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(ls,p) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,ls) 255 (type=linestring) 4294967295 0 Y 128 0 63
def COALESCE(ls,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,g) 255 4294967295 0 Y 128 0 63
def COALESCE(ls,gc) 255 4294967295 0 Y 128 0 63
COALESCE(ls,p) COALESCE(ls,ls) COALESCE(ls,pl) COALESCE(ls,mp) COALESCE(ls,mls) COALESCE(ls,mpl) COALESCE(ls,g) COALESCE(ls,gc)
SELECT
COALESCE(pl,p),
COALESCE(pl,ls),
COALESCE(pl,pl),
COALESCE(pl,mp),
COALESCE(pl,mls),
COALESCE(pl,mpl),
COALESCE(pl,g),
COALESCE(pl,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(pl,p) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,pl) 255 (type=polygon) 4294967295 0 Y 128 0 63
def COALESCE(pl,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,g) 255 4294967295 0 Y 128 0 63
def COALESCE(pl,gc) 255 4294967295 0 Y 128 0 63
COALESCE(pl,p) COALESCE(pl,ls) COALESCE(pl,pl) COALESCE(pl,mp) COALESCE(pl,mls) COALESCE(pl,mpl) COALESCE(pl,g) COALESCE(pl,gc)
SELECT
COALESCE(mp,p),
COALESCE(mp,ls),
COALESCE(mp,pl),
COALESCE(mp,mp),
COALESCE(mp,mls),
COALESCE(mp,mpl),
COALESCE(mp,g),
COALESCE(mp,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(mp,p) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,mp) 255 (type=multipoint) 4294967295 0 Y 128 0 63
def COALESCE(mp,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,g) 255 4294967295 0 Y 128 0 63
def COALESCE(mp,gc) 255 4294967295 0 Y 128 0 63
COALESCE(mp,p) COALESCE(mp,ls) COALESCE(mp,pl) COALESCE(mp,mp) COALESCE(mp,mls) COALESCE(mp,mpl) COALESCE(mp,g) COALESCE(mp,gc)
SELECT
COALESCE(mls,p),
COALESCE(mls,ls),
COALESCE(mls,pl),
COALESCE(mls,mp),
COALESCE(mls,mls),
COALESCE(mls,mpl),
COALESCE(mls,g),
COALESCE(mls,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(mls,p) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,mls) 255 (type=multilinestring) 4294967295 0 Y 128 0 63
def COALESCE(mls,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,g) 255 4294967295 0 Y 128 0 63
def COALESCE(mls,gc) 255 4294967295 0 Y 128 0 63
COALESCE(mls,p) COALESCE(mls,ls) COALESCE(mls,pl) COALESCE(mls,mp) COALESCE(mls,mls) COALESCE(mls,mpl) COALESCE(mls,g) COALESCE(mls,gc)
SELECT
COALESCE(mpl,p),
COALESCE(mpl,ls),
COALESCE(mpl,pl),
COALESCE(mpl,mp),
COALESCE(mpl,mls),
COALESCE(mpl,mpl),
COALESCE(mpl,g),
COALESCE(mpl,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(mpl,p) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,mpl) 255 (type=multipolygon) 4294967295 0 Y 128 0 63
def COALESCE(mpl,g) 255 4294967295 0 Y 128 0 63
def COALESCE(mpl,gc) 255 4294967295 0 Y 128 0 63
COALESCE(mpl,p) COALESCE(mpl,ls) COALESCE(mpl,pl) COALESCE(mpl,mp) COALESCE(mpl,mls) COALESCE(mpl,mpl) COALESCE(mpl,g) COALESCE(mpl,gc)
SELECT
COALESCE(g,p),
COALESCE(g,ls),
COALESCE(g,pl),
COALESCE(g,mp),
COALESCE(g,mls),
COALESCE(g,mpl),
COALESCE(g,g),
COALESCE(g,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(g,p) 255 4294967295 0 Y 128 0 63
def COALESCE(g,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(g,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(g,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(g,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(g,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(g,g) 255 4294967295 0 Y 128 0 63
def COALESCE(g,gc) 255 4294967295 0 Y 128 0 63
COALESCE(g,p) COALESCE(g,ls) COALESCE(g,pl) COALESCE(g,mp) COALESCE(g,mls) COALESCE(g,mpl) COALESCE(g,g) COALESCE(g,gc)
SELECT
COALESCE(gc,p),
COALESCE(gc,ls),
COALESCE(gc,pl),
COALESCE(gc,mp),
COALESCE(gc,mls),
COALESCE(gc,mpl),
COALESCE(gc,g),
COALESCE(gc,gc)
FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(gc,p) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,ls) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,pl) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,mp) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,mls) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,mpl) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,g) 255 4294967295 0 Y 128 0 63
def COALESCE(gc,gc) 255 (type=geometrycollection) 4294967295 0 Y 128 0 63
COALESCE(gc,p) COALESCE(gc,ls) COALESCE(gc,pl) COALESCE(gc,mp) COALESCE(gc,mls) COALESCE(gc,mpl) COALESCE(gc,g) COALESCE(gc,gc)
DROP TABLE t1;
#
# MDEV-20809 EXTRACT from INET6 value does not produce any warnings
#
CREATE TABLE t1 (a GEOMETRY);
SELECT EXTRACT(DAY FROM a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'extract(day)'
DROP TABLE t1;
#
# MDEV-21765 Possibly inconsistent behavior of BIT_xx functions with INET6 field
#
CREATE TABLE t1 (a GEOMETRY);
SELECT BIT_AND(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'bit_and('
SELECT BIT_OR(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'bit_or('
SELECT BIT_XOR(a) FROM t1;
ERROR HY000: Illegal parameter data type geometry for operation 'bit_xor('
DROP TABLE t1;
#
# MDEV-27666 User variable not parsed as geometry variable in geometry function.
#
set @g= point(1, 1);
select ST_AsWKT(GeometryCollection(Point(44, 6), @g));
ST_AsWKT(GeometryCollection(Point(44, 6), @g))
GEOMETRYCOLLECTION(POINT(44 6),POINT(1 1))
set @g= "just a string";
select ST_AsWKT(GeometryCollection(Point(44, 6), @g));
ERROR HY000: Illegal parameter data type longblob for operation 'geometrycollection'
SET @g= LineString(Point(0,0), Point(0,1));
SELECT AsText(PointN(@g, 1));
AsText(PointN(@g, 1))
POINT(0 0)
SELECT AsText(PointN(@g, 2));
AsText(PointN(@g, 2))
POINT(0 1)
SET @g= Point(1, 1);
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` point DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
POINT(1 1)
DROP TABLE t1;
SET @g= MultiPoint(Point(1, 1), Point(-1,-1));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` multipoint DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
MULTIPOINT(1 1,-1 -1)
DROP TABLE t1;
SET @g= LineString(Point(1, 1), Point(2,2));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` linestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
LINESTRING(1 1,2 2)
DROP TABLE t1;
SET @g= MultiLineString(LineString(Point(1, 1), Point(2,2)),
LineString(Point(-1, -1), Point(-2,-2)));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` multilinestring DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
MULTILINESTRING((1 1,2 2),(-1 -1,-2 -2))
DROP TABLE t1;
SET @g= Polygon(LineString(Point(0, 0), Point(30, 0), Point(30, 30), Point(0, 0)));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
POLYGON((0 0,30 0,30 30,0 0))
DROP TABLE t1;
SET @g= MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3),
Point(3, 0), Point(0, 3))));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` multipolygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
MULTIPOLYGON(((0 3,3 3,3 0,0 3)))
DROP TABLE t1;
SET @g= GeometryCollection(Point(44, 6), LineString(Point(3, 6), Point(7, 9)));
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometrycollection DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
GEOMETRYCOLLECTION(POINT(44 6),LINESTRING(3 6,7 9))
DROP TABLE t1;
SET @g= GeometryFromText('POINT(1 1)');
CREATE TABLE t1 AS SELECT @g AS g;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`g` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
SELECT AsText(g) FROM t1;
AsText(g)
POINT(1 1)
DROP TABLE t1;
#
# MDEV-16699 heap-use-after-free in group_concat with compressed or GIS columns
#
create table t1 (c polygon);
insert into t1 values
(PolygonFromText('POLYGON((1 2,1 2))')),
(PolygonFromText('POLYGON((0 0,1 1,0 0))'));
select length(group_concat(c, c order by 1,2)) from t1;
length(group_concat(c, c order by 1,2))
229
create table t2 as select group_concat(c, c order by 1,2), concat(c), c from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`group_concat(c, c order by 1,2)` mediumblob DEFAULT NULL,
`concat(c)` longblob DEFAULT NULL,
`c` polygon DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
drop table t1, t2;
#
# MDEV-33987 Server crashes at Item_func_as_wkt::val_str_ascii
#
SELECT ST_ASTEXT(BOUNDARY(INET6_ATON('255.255.255.255'))) AS c1;
c1
NULL
#
# Server crash in DTCollation::set_repertoire_from_charset
#
CREATE TABLE t (f POINT, KEY(f));
DELETE FROM t WHERE f NOT IN (NULL,'x');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t;
#
# MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor
#
CREATE TABLE t (a INT, b POINT);
INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0));
SELECT NTH_VALUE(a,b) OVER () FROM t;
ERROR HY000: Illegal parameter data types point and bigint for operation '-'
DROP TABLE t;
#
# MDEV-32619 Settng SRID on geometry with ST_*FromWKKB(g, srid)
#
SELECT
ST_SRID(g1),
ST_SRID(ST_GeomFromWKB(g1, 4326)),
ST_SRID(ST_GeomFromWKB(g1)),
ST_AsText(g1),
ST_SRID(ST_PointFromWKB(g2, 4326)),
ST_SRID(g2),
ST_SRID(ST_LineStringFromWKB(g3, 3)),
ST_SRID(ST_PolygonFromWKB(g4, 4)),
ST_SRID(ST_MultiPointFromWKB(g5, 5)),
ST_SRID(ST_MultiLineStringFromWKB(g6, 6)),
ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
FROM (
SELECT
POINT(1, 2) AS g1,
POINT(4, 3) AS g2,
LINESTRING(POINT(4, 3), POINT(4, 4)) AS g3,
POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3))) AS g4,
MULTIPOINT(POINT(4, 3)) AS g5,
MULTILINESTRING(LINESTRING(POINT(4, 3), POINT(4, 4))) AS g6,
MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7
) AS t;
ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7
#
# MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved
#
SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ;
ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
# End of 10.5 tests
#
# Start of 11.5 tests
#
#
# MDEV-12668 SRID is not preserved in UNION, VIEW, MIN, MAX
#
CREATE TABLE t1 (a POINT REF_SYSTEM_ID=0, b POINT REF_SYSTEM_ID=102);
SELECT a FROM t1 UNION SELECT b FROM t1;
ERROR HY000: Illegal parameter data types `point ref_system_id=0` and `point ref_system_id=102` for operation 'UNION'
DROP TABLE t1;
CREATE TABLE t1 (a POINT REF_SYSTEM_ID=101, b POINT REF_SYSTEM_ID=102);
SELECT a FROM t1 UNION SELECT b FROM t1;
ERROR HY000: Illegal parameter data types `point ref_system_id=101` and `point ref_system_id=102` for operation 'UNION'
DROP TABLE t1;
CREATE TABLE t1 (a POINT REF_SYSTEM_ID=101, b POINT REF_SYSTEM_ID=101);
CREATE TABLE t2 AS SELECT a, b FROM t1;
CREATE VIEW v2 AS SELECT a, b FROM t1;
CREATE TABLE t3 AS SELECT a FROM t1 UNION SELECT b FROM t1;
CREATE VIEW v3 AS SELECT a FROM t1 UNION SELECT b FROM t1;
CREATE TABLE t4 AS SELECT COALESCE(a,b) AS a FROM t1;
CREATE VIEW v4 AS SELECT COALESCE(a,b) AS a FROM t1;
CREATE TABLE t5 AS SELECT LEAST(a,b) AS a FROM t1;
CREATE VIEW v5 AS SELECT LEAST(a,b) AS a FROM t1;
CREATE TABLE t6 AS SELECT MIN(a) AS a FROM t1;
CREATE VIEW v6 AS SELECT MIN(a) AS a FROM t1;
CREATE TABLE t7 AS SELECT MIN(a) AS a FROM t1 UNION SELECT b FROM v2;
CREATE VIEW v7 AS SELECT MIN(a) AS a FROM t1 UNION SELECT b FROM v2;
CREATE TABLE t8 AS SELECT (SELECT a FROM t1) AS a;
CREATE VIEW v8 AS SELECT (SELECT a FROM t1) AS a;
CREATE TABLE t9 AS VALUES ((SELECT MAX(a) FROM t1)),(((SELECT MIN(b) FROM t1)));
CREATE VIEW v9 AS VALUES ((SELECT MAX(a) FROM t1)),(((SELECT MIN(b) FROM t1)));
SELECT
G_TABLE_NAME, G_GEOMETRY_COLUMN, SRID
FROM
INFORMATION_SCHEMA.GEOMETRY_COLUMNS
WHERE
F_TABLE_SCHEMA='test'
ORDER
BY G_TABLE_NAME, G_GEOMETRY_COLUMN;
G_TABLE_NAME G_GEOMETRY_COLUMN SRID
t1 a 101
t1 b 101
t2 a 101
t2 b 101
t3 a 101
t4 a 101
t5 a 101
t6 a 101
t7 a 101
t8 a 101
t9 (SELECT MAX(a) FROM t1) 101
v2 a 101
v2 b 101
v3 a 101
v4 a 101
v5 a 101
v6 a 101
v7 a 101
v8 a 101
v9 (select max(`test`.`t1`.`a`) from `test`.`t1`) 101
DROP TABLE t2,t3,t4,t5,t6,t7,t8,t9;
DROP VIEW v2,v3,v4,v5,v6,v7,v8,v9;
DROP TABLE t1;
#
# MDEV-34025 Virtual columns do not check assignment cast validity
#
CREATE TABLE t1 (a INT, b POINT GENERATED ALWAYS AS (a));
ERROR HY000: Cannot cast 'int' as 'point' in assignment of `test`.`t1`.`b`
CREATE TABLE t1 (a POINT, b INT GENERATED ALWAYS AS (a));
ERROR HY000: Cannot cast 'point' as 'int' in assignment of `test`.`t1`.`b`
# End of 11.5 tests
|