Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define empty polygon for spatial column in MySQL?

I'm trying to create spatial index over table column (bbox polygon default NULL) but get error: All parts of a SPATIAL index must be NOT NULL.

Problem is that I supposed some rows would contain NULLs. The question is: is there a way to declare column with default empty polygon?

like image 973
dmitry Avatar asked Oct 13 '11 09:10

dmitry


1 Answers

Just define the column NOT NULL and no default.

spatial columns have an implicit default of 'empty'.

Its unfortunate, because you get a warning on insert, saying there is no default value; but you cant have a explicit default value either.

like image 152
barryhunter Avatar answered Oct 17 '22 08:10

barryhunter