Comments - ST_X

6 years, 5 months ago Andrew D

ST_X(point) returns a scalar number, not a Geometry type. Do not try to cast it from a WKB to Text or it will return NULL without errors or warnings!

The same is probably true for ST_Y(), ST_Z(), and ST_M().

Example:

MariaDB [db]> select ST_Y(GeomFromText('POINT(-1 1504310400)'));
+--------------------------------------------+
|                                 1504310400 |
+--------------------------------------------+

MariaDB [db]> select ST_AsText(ST_Y(GeomFromText('POINT(-1 1504310400)')));
+-------------------------------------------------------+
| NULL                                                         |
+-------------------------------------------------------+
 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.