Bug #6277 MULTIPOLYGON produces NULL
Submitted: 27 Oct 2004 7:35 Modified: 29 Oct 2004 10:03
Reporter: Mark Overmeer Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S4 (Feature request)
Version:4.1.7 and before OS:Linux (Linux SuSE9.0)
Assigned to: Alexey Botchkov CPU Architecture:Any

[27 Oct 2004 7:35] Mark Overmeer
Description:
Creating a MULTIPOLYGON produces a NULL, without warning.  Probably related to bug 6117

How to repeat:
create table a (area GEOMETRY NOT NULL);

insert a set area=GeomFromText('POLYGON((1 1, 2 2, 3 3))');
ERROR 1048 (23000): Column 'area' cannot be null
--- probably this should warn about lack of "ring"

insert a set area=GeomFromText('POLYGON((1 1, 2 2, 3 3, 1 1))');
Query OK, 1 row affected (0.00 sec)

insert a set area=GeomFromText('MULTIPOLYGON((1 1, 2 2, 3 3, 1 1),(5 5, 6 6, 8 8, 5 5))');
ERROR 1048 (23000): Column 'area' cannot be null
--- I see no syntax error

Even the simpelest version:
 insert a set area=GeomFromText('MULTIPOLYGON((1 1, 2 2, 3 3, 1 1))');
ERROR 1048 (23000): Column 'area' cannot be null

Suggested fix:
For one, it should be nice to get parsing error messages...
[29 Oct 2004 8:59] MySQL Verification Team
This is not a bug, because you provide wrong argument for the GeomFromText() function. 
I've changed Severity to 'Feature request'.
[29 Oct 2004 9:42] Mark Overmeer
What???  Please could you specify the correct syntax than?  Do not be confused by the example: it shows both a syntactically incorrect and a syntactally correct attempt (according to the OpenGIS specs)
[29 Oct 2004 10:03] MySQL Verification Team
These INSERTS work fine for me:

mysql> INSERT INTO a SET area=GeomFromText('MULTIPOLYGON(((1 1,2 2,3 3,1 1)),((5 5,6 6,8 8,5 5)))');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO a SET area=GeomFromText('MULTIPOLYGON(((1 1,2 2,3 3,1 1),(5 5,6 6,8 8,5 5)))');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO a SET area=GeomFromText('MULTIPOLYGON(((1 1, 2 2, 3 3, 1 1)))');
Query OK, 1 row affected (0.00 sec)

mysql> SELLECT AsText(area) FROM a;
+-------------------------------------------------------+
| AsText(area)                                          |
+-------------------------------------------------------+
| POLYGON((1 1,2 2,3 3,1 1))                            |
| MULTIPOLYGON(((1 1,2 2,3 3,1 1)),((5 5,6 6,8 8,5 5))) |
| MULTIPOLYGON(((1 1,2 2,3 3,1 1),(5 5,6 6,8 8,5 5)))   |
| MULTIPOLYGON(((1 1,2 2,3 3,1 1)))                     |
+-------------------------------------------------------+
4 rows in set (0.01 sec)
[29 Oct 2004 10:56] Mark Overmeer
Ok.... triple parenthesis it is, not double.  Besides producing a nice parser error message, you probably need to add some example to the docs as well: triple
nesting doesn't come naturally... User error, no bug.