Bug #80388 ST_AsText return different values for different where condition (same geometry)
Submitted: 16 Feb 2016 9:01 Modified: 23 Aug 2017 13:18
Reporter: Emanuele Treppiccioni Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: GIS Severity:S2 (Serious)
Version:5.7.10, 5.7.13 OS:Windows
Assigned to: CPU Architecture:Any
Tags: ST_AsText

[16 Feb 2016 9:01] Emanuele Treppiccioni
Description:
For a polygon geometry ST_AsText return correct value (order of points clockwise) if the where condition is "where key = number".
If the where condition is a spatial operator ("where ST_Intersects(geometry1, geometry2") the order of the points is not clockwise.
Note that the two conditions identify the same geometry.

How to repeat:
create table mytable (fid int(11) NOT NULL AUTO_INCREMENT, shape geometry NOT NULL, UNIQUE KEY idx_did_mytable (fid), SPATIAL KEY idx_shape_mytable (shape)) ENGINE=InnoDB AUTO_INCREMENT=1;

insert into mytable values(null, ST_GeomFromText('POLYGON((13.2709057 37.3959299,13.2705331 37.396169,13.2701706 37.3965451,13.2700273 37.3966933,13.2695258 37.3970803,13.2693967 37.3970803,13.2694825 37.396807,13.269343 37.3963967,13.2691713 37.3966416,13.2690279 37.3966758,13.2689563 37.396784,13.2689421 37.3969264,13.2688708 37.3974049,13.2685486 37.3981463,13.2683339 37.3984362,13.2682669 37.3985928,13.2682598 37.3987096,13.2682639 37.3988095,13.2682532 37.3988606,13.2679039 37.3995873,13.2677757 37.4000315,13.2676332 37.400772,13.2673361 37.4013064,13.2669957 37.4018805,13.26693 37.4020857,13.2668555 37.4025983,13.2667604 37.4029456,13.2665505 37.4032753,13.2662977 37.403656,13.2662489 37.4038153,13.2660308 37.4043331,13.2658501 37.4045661,13.2657739 37.4048508,13.2656507 37.4050669,13.2655552 37.4054826,13.2654249 37.4057214,13.2652151 37.4060053,13.2650716 37.406177,13.265049 37.406204,13.2650234 37.4063028,13.2649367 37.4066369,13.2646835 37.4070233,13.2645813 37.4073478,13.2641894 37.4081044,13.2638268 37.4087923,13.2636522 37.4092418,13.2634373 37.4096001,13.2631532 37.4101679,13.2630019 37.4104702,13.2624795 37.4113894,13.2621395 37.4119548,13.2619705 37.4124265,13.2617244 37.4127958,13.2615678 37.4129816,13.2614083 37.4131708,13.2609956 37.4141492,13.2605683 37.4148485,13.2599375 37.4159858,13.259228 37.4170825,13.2589407 37.4176742,13.2585208 37.4183105,13.2582394 37.4185714,13.2581515 37.4189075,13.2579485 37.4192485,13.2575583 37.4197596,13.2571646 37.4200941,13.2570919 37.4202647,13.2569269 37.4203621,13.2568396 37.4204575,13.2568031 37.4205712,13.256688 37.4206221,13.2565149 37.4207636,13.2565001 37.4208434,13.2563607 37.4211508,13.2561212 37.421617,13.2556801 37.4221848,13.2550002 37.4229284,13.2545377 37.4234507,13.2542052 37.4238765,13.2537139 37.4244271,13.2532389 37.4247898,13.2525192 37.425094,13.2519431 37.4253818,13.2512377 37.425692,13.2506984 37.4258319,13.2501738 37.4258977,13.2497163 37.4259138,13.2494915 37.4259513,13.2492402 37.4259958,13.2491199 37.4260495,13.2490127 37.4261123,13.248877 37.4262037,13.2486278 37.4265117,13.2484288 37.4268368,13.2482917 37.4271731,13.2481522 37.4279364,13.2479179 37.4285006,13.2476556 37.4290564,13.2475275 37.4292274,13.2472696 37.4294587,13.2470625 37.42959,13.2466175 37.4295825,13.2465355 37.4296652,13.2464103 37.4296939,13.2463221 37.4297966,13.2462017 37.4302467,13.2461318 37.4304404,13.2460377 37.4305489,13.2459449 37.4306203,13.2457323 37.4307545,13.2456401 37.4309495,13.2453264 37.4313988,13.2452891 37.4314255,13.2451266 37.4315416,13.2449621 37.4315705,13.2447128 37.4315567,13.2446104 37.4315684,13.2445034 37.431674,13.244436 37.4318079,13.24435 37.4320216,13.2442147 37.4321585,13.2440398 37.4322841,13.2438539 37.4323785,13.2434671 37.432496,13.2432095 37.4325421,13.2428873 37.4325484,13.2427423 37.4325715,13.2426579 37.4326059,13.2423867 37.432803,13.2422783 37.4328561,13.2420764 37.4329261,13.2420234 37.4329432,13.2415281 37.4332573,13.2413216 37.433349,13.2410486 37.4334377,13.2407548 37.4334611,13.2403557 37.4334421,13.2402285 37.4333796,13.240187 37.4333065,13.2401684 37.4331919,13.2400529 37.4330898,13.2399815 37.433147,13.2399001 37.4332664,13.2398753 37.433312,13.2397964 37.4333522,13.2389479 37.4334107,13.2386407 37.433252,13.2383609 37.4331557,13.2380816 37.4331392,13.2377811 37.4331682,13.2371902 37.4333005,13.2369679 37.4334319,13.236741 37.433681,13.2367149 37.4337362,13.2366889 37.4338158,13.2366771 37.4339733,13.2368079 37.4343946,13.2368302 37.4346335,13.2367668 37.4348046,13.2366252 37.435135,13.2363539 37.435329,13.2355466 37.4357067,13.2353467 37.4358666,13.2352331 37.4360718,13.2348631 37.4366078,13.2349099 37.4368585,13.2349294 37.4371942,13.2348664 37.4375475,13.2347252 37.4379747,13.2344691 37.4383398,13.2341557 37.4387388,13.2339467 37.4388704,13.2335393 37.4390476,13.2333254 37.4392529,13.2332109 37.4395039,13.2330331 37.4398912,13.2327972 37.4402165,13.2325117 37.4404561,13.2324119 37.4405474,13.232191 37.4407757,13.2317928 37.4410897,13.2315855 37.4411925,13.2314073 37.4413637,13.2311802 37.4416776,13.2310661 37.4417802,13.2306378 37.4421057,13.22999 37.4423176,13.229833 37.4424431,13.2297782 37.4425515,13.22975 37.4426766,13.2298229 37.4429441,13.2298232 37.4430978,13.2298273 37.4433371,13.229728 37.4435365,13.2295712 37.4437419,13.2293215 37.443936,13.2291864 37.4441414,13.2290694 37.4448136,13.2289918 37.4450985,13.2288485 37.4453092,13.2286862 37.4456173,13.2284941 37.4459137,13.2282659 37.4463807,13.2280633 37.4469225,13.2278014 37.447612,13.2275741 37.4480224,13.2272103 37.448359,13.2266371 37.4487872,13.2259286 37.4491067,13.2256808 37.4491634,13.225627 37.4492204,13.2255612 37.4498874,13.225457 37.450372,13.225159 37.4509586,13.224921 37.4513461,13.2247568 37.4515167,13.224351 37.4519897,13.2236903 37.4526958,13.2231309 37.4534483,13.2223694 37.4544389,13.2220779 37.4547517,13.2219015 37.4549783,13.2216609 37.4552161,13.2214007 37.4554781,13.2212534 37.4556374,13.2211745 37.4557313,13.2210192 37.455931,13.2208827 37.4561359,13.2206924 37.456338,13.2204445 37.45658,13.220215 37.4567954,13.2201209 37.4568565,13.2196006 37.4573486,13.219047 37.4579356,13.218572 37.4583107,13.2177089 37.4591022,13.2170933 37.459552,13.2164755 37.4599616,13.2155711 37.4606223,13.2149102 37.4611003,13.2142637 37.4615782,13.2135885 37.461942,13.2128271 37.4623745,13.2121519 37.4626927,13.2110887 37.4632271,13.2099969 37.4636247,13.2091893 37.4639031,13.2085683 37.4640879,13.2077435 37.4641978,13.2072146 37.4643057,13.205761 37.4644118,13.2053179 37.4643656,13.2048178 37.4642282,13.2044588 37.4640852,13.2041968 37.4640562,13.2037659 37.4640728,13.2033799 37.4641238,13.2031001 37.4641804,13.2030566 37.4651491,13.2028518 37.4662867,13.2028061 37.4668101,13.2028062 37.46747,13.2028745 37.467743,13.2029882 37.4682435,13.203011 37.4686759,13.2030793 37.4690627,13.2032613 37.4695407,13.2036254 37.4704509,13.2037164 37.4708377,13.203431 37.4712056,13.2021597 37.471963,13.2011307 37.4729242,13.2004563 37.4735768,13.2010203 37.4744981,13.2019716 37.4750606,13.2027898 37.4752414,13.2032916 37.4755092,13.203717 37.4757365,13.2045903 37.4761015,13.2054821 37.4760506,13.2062418 37.4759071,13.2070856 37.4762229,13.2082062 37.4770086,13.2092868 37.4772979,13.2105034 37.4773592,13.2114605 37.4779261,13.2124042 37.4786469,13.2145905 37.4810322,13.215415 37.4814839,13.2164372 37.4819414,13.2174503 37.4824848,13.2187698 37.4833214,13.2194326 37.484119,13.2202751 37.4846201,13.221637 37.4855537,13.2251097 37.4873139,13.2257131 37.4879415,13.2262734 37.4889456,13.2273132 37.489623,13.2275524 37.4901328,13.2276673 37.490418,13.2282709 37.4913648,13.2288888 37.4918672,13.229917 37.4923712,13.2308005 37.4931789,13.2316229 37.4937886,13.2320505 37.4943794,13.232841 37.4951212,13.2335935 37.4958884,13.2344314 37.4966787,13.2356184 37.4974135,13.2371634 37.498213,13.2375348 37.4984673,13.2381234 37.4991611,13.2382363 37.4996426,13.237821 37.5009658,13.2377492 37.5012051,13.2375633 37.5014538,13.2374431 37.5016151,13.2384523 37.5023767,13.2398541 37.5028685,13.240465 37.5033689,13.2405417 37.5042441,13.2402172 37.5051168,13.2398807 37.5059672,13.2398228 37.5065528,13.2390805 37.507539,13.238826 37.5094812,13.2388916 37.5101171,13.2391398 37.5105828,13.2393468 37.5112143,13.2394946 37.5113307,13.2395933 37.5114085,13.2403558 37.5115837,13.2408338 37.5116605,13.2413509 37.511678,13.2416436 37.5114671,13.2418301 37.511057,13.2426129 37.5105107,13.242634 37.5105046,13.2428296 37.5104483,13.2431803 37.5103478,13.2435826 37.5102323,13.2439275 37.5102669,13.2446746 37.5107349,13.2449603 37.5112502,13.2446608 37.5124702,13.2443308 37.5132363,13.2444477 37.5137613,13.2446181 37.5142871,13.2448275 37.5146958,13.245059 37.5147604,13.2454226 37.5148566,13.245671 37.514604,13.2458402 37.5140997,13.2460693 37.5140255,13.2462321 37.5139728,13.2464958 37.5138879,13.2465245 37.5137285,13.246919 37.5138153,13.2476598 37.5145273,13.2483425 37.5149383,13.2492852 37.5159495,13.2502007 37.5166211,13.2511264 37.5170708,13.2519418 37.5178705,13.2523953 37.5186581,13.2535778 37.5201701,13.2546015 37.5211696,13.2552512 37.5221301,13.2567127 37.5242203,13.2571154 37.5247693,13.2572137 37.5251065,13.2571603 37.5257263,13.2569472 37.5262855,13.2569903 37.5274141,13.2570495 37.5280122,13.2570936 37.5284559,13.2575373 37.5293114,13.2581825 37.5298339,13.2589669 37.5300287,13.2593305 37.5300752,13.2597343 37.530127,13.2607196 37.5302542,13.2614936 37.5297882,13.2624319 37.5302579,13.2627935 37.5308617,13.2630393 37.5312264,13.2631793 37.5311893,13.2643565 37.5308794,13.2659128 37.5309894,13.2662702 37.531015,13.2682498 37.5313121,13.2693181 37.531561,13.2704862 37.5317179,13.2715506 37.5317997,13.27296 37.5313923,13.2742604 37.5309192,13.2752122 37.5300451,13.2762911 37.5287849,13.2772679 37.5277658,13.2781872 37.5267028,13.2792539 37.5263425,13.2803198 37.5260132,13.2803706 37.5257324,13.2804629 37.5255781,13.2807144 37.5254409,13.2811031 37.5253037,13.2813546 37.5251436,13.2818576 37.5248692,13.2830009 37.5244347,13.2840528 37.5240689,13.2852188 37.5236802,13.2862022 37.5232458,13.2867282 37.5229942,13.286911 37.5228571,13.287254 37.5225826,13.2881916 37.5218965,13.2891291 37.5211649,13.2891976 37.5210504,13.2894262 37.5208219,13.2896244 37.5206424,13.2896962 37.5205688,13.2899977 37.5202961,13.290131 37.5200001,13.2902069 37.5195027,13.2902511 37.5191426,13.2902921 37.5189325,13.2903898 37.5181273,13.2906704 37.5178072,13.2909068 37.5176246,13.29103 37.5175178,13.2911247 37.5173736,13.2920521 37.5167259,13.2926014 37.5163773,13.2927118 37.5162942,13.2928187 37.5161749,13.2931856 37.5162208,13.2932591 37.5162224,13.2942636 37.5162437,13.2949745 37.5162896,13.2953874 37.5163355,13.2957773 37.5164043,13.296236 37.5164043,13.2967406 37.5164731,13.2975203 37.5167253,13.2985065 37.5169775,13.2990111 37.5172299,13.2998597 37.5177803,13.3007312 37.5187206,13.3010294 37.5191334,13.3012127 37.5193169,13.3015338 37.5195463,13.3020235 37.5197186,13.3026197 37.5199967,13.3030085 37.5195622,13.3033973 37.5191276,13.3038548 37.5184185,13.3042818 37.5180679,13.3058661 37.5169169,13.3089368 37.5140563,13.3108796 37.5120364,13.3116424 37.5112875,13.3122158 37.5106682,13.3133707 37.5102561,13.3148993 37.5098785,13.3153726 37.5098765,13.3162094 37.5095812,13.3171564 37.5097146,13.3179785 37.5098185,13.3187872 37.5095096,13.319233 37.5090982,13.3200899 37.5085489,13.3208788 37.508206,13.3215528 37.5073684,13.3217018 37.50704,13.3219075 37.5068343,13.3211872 37.5062169,13.3200556 37.505291,13.3193013 37.5046394,13.3189926 37.504365,13.3185849 37.5039963,13.3183409 37.503782,13.3181062 37.503411,13.3179371 37.5028701,13.3178117 37.5026893,13.3171406 37.5019302,13.3163862 37.5010385,13.3159793 37.5005437,13.3158683 37.5004081,13.3153096 37.4998728,13.3145313 37.4993524,13.3139684 37.499036,13.3122262 37.4979241,13.3117675 37.4976375,13.3114892 37.4973671,13.310808 37.496603,13.3104967 37.496254,13.309623 37.4951345,13.3091868 37.4942142,13.3091111 37.4940548,13.3089514 37.4937181,13.3088846 37.4935142,13.3086716 37.4928644,13.3086961 37.4927061,13.3087601 37.4922936,13.30851 37.4917421,13.3080053 37.4911869,13.3077772 37.4906442,13.3084282 37.4901668,13.3091478 37.4901015,13.309342 37.4900839,13.3100244 37.4902579,13.3107822 37.4905254,13.3115117 37.490536,13.3124636 37.4901453,13.3137448 37.4898215,13.3148814 37.4898389,13.315918 37.4899392,13.3169235 37.4896697,13.3177736 37.48952,13.3185639 37.4894798,13.3196073 37.4891329,13.320634 37.4890483,13.3216509 37.488783,13.3225546 37.4880226,13.3230746 37.4872868,13.3245495 37.4865396,13.325129 37.4859336,13.3261039 37.4855652,13.327118 37.484934,13.3274299 37.4842422,13.3277504 37.4836858,13.3288033 37.4835104,13.3297935 37.4830647,13.330825 37.4824469,13.3327338 37.4817808,13.3332217 37.4816628,13.3335969 37.4814743,13.3337978 37.481185,13.3340675 37.4805448,13.3345127 37.4796338,13.3351793 37.4786191,13.335934 37.4777069,13.3365631 37.4773485,13.3371796 37.4766855,13.3373387 37.476538,13.3374432 37.4764149,13.3375128 37.4763335,13.337679 37.4764501,13.3377702 37.4766759,13.3383172 37.47803,13.3389032 37.4794809,13.3392275 37.4801897,13.3395375 37.4805439,13.3407569 37.480949,13.3418984 37.4811474,13.3436976 37.4814967,13.3443819 37.4818621,13.3448704 37.4823025,13.3458823 37.4840809,13.34653 37.4848875,13.3480175 37.4852389,13.3491385 37.4854433,13.3501928 37.4855337,13.3509473 37.4855895,13.3519348 37.4855622,13.3523922 37.4855236,13.3545933 37.4853243,13.3554463 37.4852524,13.3566536 37.4851313,13.3580066 37.4847743,13.3592089 37.4843841,13.3602653 37.4842443,13.3608316 37.4840417,13.3612065 37.4838073,13.3617982 37.4841087,13.3624939 37.4841693,13.3633622 37.4842945,13.3646764 37.4842563,13.3653449 37.484098,13.3655838 37.4840647,13.3660603 37.4839986,13.3667438 37.4839283,13.3676535 37.4836002,13.3683465 37.4835031,13.3689717 37.4838246,13.3694611 37.4840421,13.3702169 37.4845034,13.3712201 37.4850925,13.3713417 37.485164,13.3718909 37.4852671,13.3724362 37.485156,13.3731318 37.4848044,13.3735543 37.4842062,13.3739827 37.4838916,13.3742853 37.4835934,13.374649 37.4832923,13.3751437 37.4829387,13.3754808 37.4827291,13.3759316 37.4825415,13.3766668 37.4821931,13.376892 37.481806,13.3772874 37.481267,13.3772809 37.4809548,13.3769446 37.4805195,13.3767226 37.4800817,13.3767201 37.4796778,13.3769454 37.4792925,13.3771362 37.4789986,13.3772612 37.4787795,13.3774338 37.4784926,13.377932 37.4781309,13.3782234 37.4775917,13.3784754 37.4769863,13.3788257 37.4763236,13.3791682 37.4761329,13.3796925 37.4760556,13.3800663 37.4759985,13.3802189 37.4759326,13.3802646 37.4757946,13.3802397 37.4756181,13.3801957 37.4754386,13.3799635 37.4752364,13.379709 37.4750745,13.3794665 37.4749065,13.3794204 37.4748583,13.3787408 37.4737842,13.378721 37.4734045,13.3788818 37.4731434,13.3793439 37.4730693,13.3797125 37.4731703,13.3792008 37.4727035,13.3790188 37.4724092,13.3798883 37.4721215,13.3804382 37.471763,13.3807844 37.4713135,13.3810476 37.4708422,13.3811943 37.4705479,13.3814475 37.4702951,13.3819701 37.4699571,13.3823236 37.4693699,13.382472 37.4687463,13.38254 37.4681435,13.3825538 37.4677951,13.3825744 37.4672812,13.3824042 37.4665445,13.3821152 37.4655332,13.3819993 37.4649733,13.3820331 37.4642027,13.3821207 37.4635749,13.3820931 37.4630143,13.3819546 37.462496,13.3820003 37.4622412,13.3824817 37.4617042,13.3828595 37.4614465,13.3831628 37.4611565,13.3833463 37.4607185,13.3832476 37.4603802,13.3828498 37.4598002,13.3822899 37.4592388,13.3822203 37.459103,13.3821926 37.45896,13.3825898 37.4576836,13.3814724 37.4572518,13.3804549 37.4566745,13.37938 37.4556791,13.3787796 37.4547348,13.3780308 37.4533015,13.3771725 37.4522608,13.3766784 37.451823,13.3757013 37.451264,13.3745009 37.4506234,13.3726063 37.449274,13.3714066 37.4494095,13.3702554 37.4487997,13.3677375 37.4475238,13.3665065 37.4460427,13.3660087 37.445419,13.3658516 37.4452221,13.3655068 37.4447904,13.3641229 37.4447352,13.3612946 37.4446224,13.3591476 37.4444925,13.3556529 37.4442811,13.3556302 37.4442584,13.3556302 37.4441901,13.3555905 37.4420819,13.3555857 37.4418242,13.3555775 37.4413903,13.356296 37.4407291,13.3571382 37.4398594,13.3574591 37.4395584,13.3580469 37.4390077,13.3577184 37.4373334,13.3562993 37.4371811,13.3550834 37.4373164,13.3550391 37.4373175,13.3542881 37.4372985,13.3541013 37.4373182,13.3539685 37.4373065,13.3537064 37.4372776,13.3535771 37.4372803,13.3532144 37.4373168,13.3525967 37.43735,13.3524743 37.4373901,13.3502857 37.437295,13.3491234 37.4354897,13.3485402 37.4346447,13.3483906 37.4345542,13.3482685 37.4344803,13.3477074 37.4341411,13.3469319 37.4340829,13.3458689 37.4344235,13.3434413 37.4349332,13.3427664 37.4349548,13.3417896 37.4350787,13.3408276 37.4346321,13.339794 37.4341283,13.339363 37.4336481,13.3386886 37.4329052,13.3380285 37.4322649,13.3374116 37.4314193,13.3368946 37.4312244,13.3356019 37.4314049,13.33474 37.4316773,13.3338351 37.4319497,13.332729 37.4322558,13.3321254 37.4326771,13.3315982 37.43437,13.3313238 37.434711,13.3308063 37.4348113,13.3292409 37.4347818,13.3277484 37.4344788,13.3265071 37.434203,13.3261476 37.4338068,13.3256367 37.4329796,13.3256014 37.4329061,13.3253113 37.4323525,13.325252 37.4318371,13.3250624 37.4313672,13.3242459 37.4309404,13.3229123 37.430467,13.3217368 37.4299943,13.319688 37.4289021,13.3175516 37.4281515,13.3154784 37.4275771,13.3146433 37.4273922,13.3135316 37.4274692,13.3126426 37.4276398,13.3120108 37.4276142,13.3115507 37.4277262,13.3110902 37.4279521,13.3099671 37.4285401,13.3097347 37.4290863,13.3086117 37.4296742,13.3066586 37.4296425,13.3056375 37.429524,13.3055393 37.4294875,13.3052187 37.4293683,13.3050223 37.4292646,13.3047213 37.4291435,13.3043555 37.4290335,13.3041116 37.4289925,13.303954 37.4289177,13.3034822 37.4284652,13.3031193 37.428142,13.3026172 37.4276518,13.3022491 37.4272319,13.3014894 37.4266245,13.3008194 37.4260122,13.3001213 37.4251389,13.3000732 37.4250788,13.2999888 37.4249754,13.2998984 37.4248648,13.2985726 37.4234471,13.2978851 37.4226245,13.2977764 37.4225147,13.2977132 37.4224271,13.2976315 37.4222051,13.2978829 37.4220884,13.2976971 37.4219052,13.2974571 37.4217443,13.2971723 37.42123,13.2971608 37.4210525,13.2973447 37.4207117,13.2980001 37.4204569,13.2993036 37.4206025,13.3001626 37.4205929,13.3007604 37.4200454,13.3010352 37.4189837,13.3013226 37.4179627,13.3014633 37.4172058,13.3012953 37.4163051,13.3012578 37.4161476,13.3005718 37.4160551,13.3000537 37.4163844,13.300019 37.4170852,13.2999174 37.4178186,13.2993275 37.4182169,13.2983605 37.4186846,13.2973231 37.4192891,13.2964225 37.4197108,13.2963333 37.4197526,13.2960569 37.4192828,13.2956595 37.4193152,13.295504 37.4193281,13.2950829 37.4187251,13.2940286 37.4190814,13.2930312 37.4197032,13.2917099 37.420493,13.2911791 37.4207547,13.2904555 37.4209971,13.2899952 37.4208917,13.289657 37.4204411,13.289423 37.4198621,13.2894919 37.4191744,13.2898365 37.4186808,13.2904873 37.4184668,13.2917676 37.4181022,13.2925786 37.417732,13.2930695 37.4172088,13.2918937 37.4169572,13.2910586 37.4162888,13.290535 37.415647,13.2902478 37.415209,13.2904044 37.4148993,13.290571 37.4142731,13.2903218 37.4140107,13.2899974 37.4139212,13.2891209 37.4146313,13.2881294 37.4162379,13.2872984 37.4172094,13.2866765 37.4176895,13.2859518 37.4178821,13.2852991 37.4175225,13.2842642 37.4165231,13.2838186 37.4160787,13.2838903 37.4152688,13.2843911 37.4146868,13.2854343 37.4143308,13.2871463 37.4140631,13.2885624 37.4137008,13.2892437 37.4133462,13.2896512 37.4131226,13.2896503 37.4128427,13.2891723 37.4122135,13.2903578 37.4119344,13.2907644 37.4118387,13.2909487 37.4117956,13.2927027 37.4108949,13.2929386 37.4108278,13.2934037 37.4111408,13.2941733 37.4114219,13.2950203 37.4113852,13.2957595 37.411093,13.2958996 37.410309,13.2956981 37.4094179,13.2954928 37.4088521,13.2939563 37.4084032,13.292657 37.4079458,13.2914241 37.4074285,13.2901104 37.4068403,13.2892254 37.4064648,13.2893398 37.4063326,13.2894479 37.4060973,13.289466 37.4053674,13.2891829 37.4045225,13.2885995 37.4034594,13.2877247 37.4032729,13.2869658 37.4032656,13.28639 37.4031754,13.2853132 37.4031931,13.2850255 37.4032943,13.2841535 37.4033654,13.2831809 37.4034446,13.2817912 37.4034764,13.2803705 37.4036399,13.2772517 37.404267,13.277196 37.404278,13.2767248 37.4043733,13.2761924 37.4044291,13.2756535 37.4044859,13.2745538 37.4043505,13.2737432 37.4040069,13.2734864 37.4034148,13.273485 37.4026198,13.2742205 37.4021649,13.2745244 37.4019982,13.2747731 37.4018622,13.2749624 37.4018743,13.2756052 37.4019162,13.2763833 37.4019934,13.2773448 37.4019529,13.2778238 37.401881,13.2792826 37.4018147,13.2805396 37.4014265,13.2806558 37.4011648,13.2805012 37.4004913,13.2801589 37.4000677,13.2794862 37.3996427,13.2789275 37.3994122,13.2776023 37.3988612,13.2739332 37.3971845,13.2728426 37.3966258,13.2720822 37.3962039,13.2709057 37.3959299))'));

SELECT ST_AsText(shape) FROM mytable WHERE fid = 1; (correct value)

SELECT ST_AsText(shape) FROM mytable WHERE ST_Intersects(ST_GeomFromText('POLYGON ((13.2393745468325 37.4248138006216,13.2955803613693 37.4248138006216,13.2955803613693 37.4962140099973,13.2393745468325 37.4962140099973,13.2393745468325 37.4248138006216))'),shape); (incorrect value)
[11 Jul 2016 12:38] MySQL Verification Team
Hello Emanuele Treppiccioni,

Thank you for the report and test case.
With 5.7.13, I'm not seeing any discrepancy in both the queries and seems to be fine. Could you please check against 5.7.13 and let us know if you are still having this issue?

Thanks,
Umesh
[11 Jul 2016 12:38] MySQL Verification Team
test results

Attachment: 80388.results (application/octet-stream, text), 38.94 KiB.

[12 Jul 2016 9:10] Emanuele Treppiccioni
Your attached file 8388.results have the same problem of 5.7.10.
The second point of the second query is wrong.
The order of the points is inverted.
[12 Jul 2016 9:43] MySQL Verification Team
Thank you for the feedback.
[23 Aug 2017 13:18] Norvald Ryeng
Fixed in 8.0.