Bug #88513 GIS Inconsistencies 8.0.3 vs 5.7.19 vs 5.7.19 with previous function names
Submitted: 16 Nov 2017 8:09 Modified: 21 Nov 2017 14:04
Reporter: Roel Van de Paar Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: GIS Severity:S1 (Critical)
Version:8.0.3, 5.7.19 OS:Any
Assigned to: CPU Architecture:Any

[16 Nov 2017 8:09] Roel Van de Paar
Description:
============= 8.0.3 

8.0.3>SELECT ST_AsText(ST_SYMDIFFERENCE(ST_MultiLineStringFromText('ST_MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),ST_Envelope(ST_GeometryFromText('ST_MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
ERROR 3037 (22023): Invalid GIS data provided to function st_multilinestringfromtext.

============= 5.7.19, same query, different output

5.7.19>SELECT ST_AsText(ST_SYMDIFFERENCE(ST_MultiLineStringFromText('ST_MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),ST_Envelope(ST_GeometryFromText('ST_MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
ERROR 3037 (22023): Invalid GIS data provided to function st_geometryfromtext.

============= 5.7.19, with previous function names, different output: result

5.7.19>SELECT AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)'))));
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| AsText(ST_SYMDIFFERENCE(MultiLineStringFromText('MULTILINESTRING((7 7,1 7,8 5,7 8,7 7),(6 3,3 4,1 1,9 9,9 0,8 4,9 9))'),Envelope(GeometryFromText('MULTIPOINT(7 9,0 0,3 7,1 6,0 0)')))) |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GEOMETRYCOLLECTION(POLYGON((0 0,7 0,7 9,0 9,0 0)),MULTILINESTRING((7 5.285714285714286,8 5,7 8),(7 7,9 9,9 0,8 4,9 9)))                                                                 |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set, 4 warnings (0.01 sec)

5.7.19>show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                        |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'ASTEXT' is deprecated and will be removed in a future release. Please use ST_ASTEXT instead                                   |
| Warning | 1287 | 'MULTILINESTRINGFROMTEXT' is deprecated and will be removed in a future release. Please use ST_MULTILINESTRINGFROMTEXT instead |
| Warning | 1287 | 'ENVELOPE' is deprecated and will be removed in a future release. Please use ST_ENVELOPE instead                               |
| Warning | 1287 | 'GEOMETRYFROMTEXT' is deprecated and will be removed in a future release. Please use ST_GEOMETRYFROMTEXT instead               |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.01 sec)

How to repeat:
As per above. Also see bug 83737
[16 Nov 2017 8:11] Roel Van de Paar
Please use a debug build
[17 Nov 2017 12:27] Norvald Ryeng
The output is correct. The WKT strings in the two first queries are invalid, using "ST_MULTILINESTRING" and "ST_MULTIPOINT" instead of "MULTILINESTRING" and "MULTIPOINT".

If the same parameters are given to the third query (using old function names), it too fails with the same error message.
[19 Nov 2017 21:09] Roel Van de Paar
Norvald, thank you for your input. I am not following, would you elaborate a bit more please?

Also, note that 8.0.3 and 5.7.19 - for the same query - produce different output;

ERROR 3037 (22023): Invalid GIS data provided to function st_multilinestringfromtext.
ERROR 3037 (22023): Invalid GIS data provided to function st_geometryfromtext.
[20 Nov 2017 5:22] MySQL Verification Team
could the fix for https://bugs.mysql.com/bug.php?id=80627 have anything to do with this...?
[21 Nov 2017 14:04] Norvald Ryeng
The function names have been standardized on "ST_", e.g., ST_AsText, ST_MultiLineStringFromText, etc.

However, the WKT format has not changed, so in any ST_<something>FromText function, the WKT input string should still be "MULTIPOINT(...)", not "ST_MULTIPOINT(...)".

The only difference in the error message between MySQL 8.0.3 and 5.7.19 is the function name. There is a bug in MySQL 5.7.19 where the wrong function is named in the error message: MySQL 5.7.19 says that the function name is "st_geometryfromtext", while it really is "st_multilinestringfromtext". That bug is no longer there in 8.0.3.