Bug #103678 ST_Contains function returns incorrect result.
Submitted: 13 May 8:45 Modified: 13 May 16:10
Reporter: Eunbin Baek Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: GIS Severity:S2 (Serious)
Version:MySQL 8.0.20, MySQL 8.0.25 OS:Linux
Assigned to: CPU Architecture:x86
Tags: regression

[13 May 8:45] Eunbin Baek
Description:
In certain circumstances, ST_Contains function returns incorrect result. Will attach outputs.

How to repeat:
mysql> SET @SRID := 4326 /* WGS84 */;
Query OK, 0 rows affected (0.00 sec)

mysql> SET @point:= ST_GeomFromText('POINT(89.50249779176816 126.96600537699246)', @SRID);
Query OK, 0 rows affected (0.00 sec)

mysql> SET @polygon := ST_GeomFromText('POLYGON((37.399190586836184 126.965669993654370,37.398563808320795 126.966005172597650,37.398563484045880 126.966005467513980,37.398563277873926 126.966005991634870,37.398563316804754 126.966006603730260,37.398687101343120 126.966426067601090,37.398687548434204 126.966426689671760,37.398687946717580 126.966426805810510,37.398688339525570 126.966426692691090,37.399344708725290 126.966027255005050,37.399344924786035 126.966026657464910,37.399344862437594 126.966026073608450,37.399285401380960 126.965848242476900,37.399284911074280 126.965847737879930,37.399284239833094 126.965847784502270,37.399260339325880 126.965861778579070,37.399191408765940 126.965670657332960,37.399191087858530 126.965670183150050,37.399190586836184 126.965669993654370))', @SRID);
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT ST_Contains(@polygon, @point) as within_polygon;
+----------------+
| within_polygon |
+----------------+
|              1 | ==> It should be false(0).
+----------------+
1 row in set (0.00 sec)
[13 May 9:29] MySQL Verification Team
Hello Eunbin Baek,

Thank you for the report and test case.

regards,
Umesh
[13 May 16:10] Eunbin Baek
Hi Umesh, thank you for the quick reply.
This problem does not appear in projected coordinate systems such as SRID 3857.
It seems to work incorrectly for geographic coordinate systems.
Can you please let me know if there are plans to fix this bug in a future release?