Bug #52927 GeomFromText('POINT(31.5,42.2)') failure..
Submitted: 18 Apr 2010 18:59 Modified: 27 May 2010 9:29
Reporter: Martin Gainty Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: GIS Severity:S2 (Serious)
Version:5.1.45-community OS:Any (GeomFromText failure)
Assigned to: CPU Architecture:Any
Tags: GeomFromText failure

[18 Apr 2010 18:59] Martin Gainty
Description:
mysql> show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| protocol_version        | 10                           |
| version                 | 5.1.45-community             |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | ia32                         |
| version_compile_os      | Win32                        |
+-------------------------+------------------------------+
5 rows in set (0.01 sec)

mysql> select GeomFromText('POINT(31.5,42.2)');
+----------------------------------+
| GeomFromText('POINT(31.5,42.2)') |
+----------------------------------+
| NULL                             |
+----------------------------------+
1 row in set (0.01 sec)

mysql> INSERT INTO Points (name,location) VALUES('point1',GeomFromText('POINT(31
.5,42.2)'));
ERROR 1048 (23000): Column 'location' cannot be null

5.1.45-community version of GeomFromText does not MAKEPOINT 
?

Martin Gainty
18-APR-2010

How to repeat:
mysql>create table Points (
name VARCHAR(20) PRIMARY KEY,
location Point NOT NULL,
description VARCHAR(200),
SPATIAL INDEX(location)
); 
mysql> desc Points;
+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| name        | varchar(20)  | NO   | PRI | NULL    |       |
| location    | point        | NO   | MUL | NULL    |       |
| description | varchar(200) | YES  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+

mysql> select GeomFromText('POINT(31.5,42.2)');

always returns NULL

Suggested fix:
I would need a quick look at the GIS source to suggest a solution.
[19 Apr 2010 8:43] Valeriy Kravchuk
Check 

select GeomFromText('POINT(31.5 42.2)');

Read http://dev.mysql.com/doc/refman/5.1/en/populating-spatial-columns.html.
[19 Apr 2010 12:28] Martin Gainty
mysql> desc Points;
+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| name        | varchar(20)  | NO   | PRI | NULL    |       |
| location    | point        | NO   | MUL | NULL    |       |
| description | varchar(200) | YES  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
3 rows in set (0.00 sec)

mysql> INSERT INTO Points (name,location) VALUES('point1',GeomFromText('POINT(1,
1)'));
ERROR 1048 (23000): Column 'location' cannot be null

mysql> SET @g=GeomFromText('POINT(1,1)');
Query OK, 0 rows affected (0.02 sec)

mysql> INSERT INTO points (name,location) VALUES('point1',@g);
ERROR 1048 (23000): Column 'location' cannot be null

GeomFromText('POINT(AnyNumericValue,AnyNumericValue)')) ALWAYS returns null
[19 Apr 2010 13:08] Valeriy Kravchuk
Please, be more careful. Do NOT put comma when defining POINT. Use

GeomFromText('POINT(1 1)');

instead of

GeomFromText('POINT(1,1)');
[19 May 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[19 May 2010 23:34] Martin Gainty
mysql> CREATE TABLE Points (
    -> name VARCHAR(20) PRIMARY KEY,
    -> location POINT NOT NULL,
    -> description VARCHAR(200),
    -> SPATIAL INDEX(location)
    -> );
Query OK, 0 rows affected (0.05 sec)

mysql> desc POINTS;
+-------------+--------------+------+-----+---------+-------+
| Field       | Type         | Null | Key | Default | Extra |
+-------------+--------------+------+-----+---------+-------+
| name        | varchar(20)  | NO   | PRI | NULL    |       |
| location    | point        | NO   | MUL | NULL    |       |
| description | varchar(200) | YES  |     | NULL    |       |
+-------------+--------------+------+-----+---------+-------+
3 rows in set (0.03 sec)

mysql> INSERT INTO Points (name,location) VALUES('point1',GeomFromText('POINT(31
.5 42.2)'));
Query OK, 1 row affected (0.00 sec)

mysql> select * FROM POINTS;
+--------+---------------------------+-------------+
| name   | location                  | description |
+--------+---------------------------+-------------+
| point1 |     ☺☺        Ç?@ÜÖÖÖÖ↓E@ | NULL        |
+--------+---------------------------+-------------+
1 row in set (0.00 sec)
[27 May 2010 9:29] Sveta Smirnova
Thank you for the feedback.

So now everything works fine and I am closing the report as "Not a Bug". Use GIS functions to get readable output of data in the table.