| Bug #54768 | linestring function produces null if arguments have asbinary applied | ||
|---|---|---|---|
| Submitted: | 24 Jun 2010 10:36 | Modified: | 26 Jul 2012 6:28 |
| Reporter: | Clive Cox | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: GIS | Severity: | S3 (Non-critical) |
| Version: | 5.0.82, 5.5.5-m3 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | GIS linestring asbinary | ||
[24 Jun 2010 10:59]
Valeriy Kravchuk
Verified just as described. Also with current mysql-trunk from bzr:
mysql> select version();
+----------------+
| version() |
+----------------+
| 5.5.5-m3-debug |
+----------------+
1 row in set (0.00 sec)
mysql> select linestring(asbinary(GeomFromText("point(52.1
0.1)")),asbinary(GeomFromText("point(52.1 0.1)"))) as a;
+------+
| a |
+------+
| NULL |
+------+
1 row in set (0.01 sec)
mysql> select astext(linestring(GeomFromText("point(52.1 0.1)"),GeomFromText("point(52.1
0.1)"))) as a;
+-------------------------------+
| a |
+-------------------------------+
| LINESTRING(52.1 0.1,52.1 0.1) |
+-------------------------------+
1 row in set (0.00 sec)
[6 Feb 2012 19:27]
Rob Porter
Still present in 5.0.92
[26 Jul 2012 6:28]
Alexander Barkov
This is not a bug. The function LineString() expects arguments of data type Geometry, and specifically, Point. Point (like any other Geometry types) consists of two pieces of information: - SRID - WKB The result of the function AsBinary() is not a valid Geometry value. It's a binary array VARBINARY(N), representing the WKB part of the original Geometry value, without SRID. The function LineString correctly returns NULL, because of the wrong arguments' data type: VARBINARY(N) vs GEOMETRY.

Description: From mysql 5.0.82 select linestring(asbinary(GeomFromText("point(52.1 0.1)")),asbinary(GeomFromText("point(52.1 0.1)"))); produces NULL but select astext(linestring(GeomFromText("point(52.1 0.1)"),GeomFromText("point(52.1 0.1)"))); works How to repeat: as described in description above.