Bug #14807 GeomFromText() should return MYSQL_TYPE_GEOMETRY
Submitted: 9 Nov 2005 21:30 Modified: 4 Oct 2006 20:35
Reporter: Peter Yuill Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0-BK, 5.0.15 OS:Linux (Linux, Windows)
Assigned to: Alexey Botchkov CPU Architecture:Any

[9 Nov 2005 21:30] Peter Yuill
Description:
GeomFromText(), GeomFromWKB() and all related functions (eg PointFromText) currently return MYSQL_TYPE_VAR_STRING. Network clients such as Connector/J convert VAR_STRING values to the native character set on the client platform, destroying geometry values. Geometry objects need to be recognised as binary by network clients, whether they have been sourced from Geometry columns (correctly return MYSQL_TYPE_GEOMETRY) or from geometry creation functions.

How to repeat:
Monitor return values.
[10 Nov 2005 8:34] Valeriy Kravchuk
Thank you for a bug report. The problem can be demonstrated by the following SQL statements:

mysql> create table tg(c1 point) engine=MyISAM;
Query OK, 0 rows affected (0.06 sec)

mysql> desc tg;
+-------+-------+------+-----+---------+-------+
| Field | Type  | Null | Key | Default | Extra |
+-------+-------+------+-----+---------+-------+
| c1    | point | YES  |     | NULL    |       |
+-------+-------+------+-----+---------+-------+
1 row in set (0.00 sec)

mysql> create table tg2 engine=MyISAM as select GeomFromText('POINT(1 1)');
Query OK, 1 row affected (0.09 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> desc tg2;
+----------------------------+----------+------+-----+---------+-------+
| Field                      | Type     | Null | Key | Default | Extra |
+----------------------------+----------+------+-----+---------+-------+
| GeomFromText('POINT(1 1)') | longblob | NO   |     |         |       |
+----------------------------+----------+------+-----+---------+-------+
1 row in set (0.01 sec)

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.0.16    |
+-----------+
1 row in set (0,00 sec)

So, GeomFromText does not return POINT type.

Verified with 5.0.15-nt on XP and with 5.0.16-BK (ChangeSet@1.1972, 2005-11-05 22:45:54-08:00, igor@rurik.mysql.com) on Linux.
[4 Jul 2006 7:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/8677
[26 Jul 2006 21:19] Jim Winstead
Patch looks good to me.
[16 Aug 2006 20:49] Reggie Burnett
Pushed into 5.0.25
[4 Oct 2006 20:35] Paul DuBois
Noted in 5.0.25 changelog.

CREATE TABLE ... SELECT statements that selected GEOMETRY values
resulted in a table that contained BLOB columns, not GEOMETRY
columns. (Bug #14807)