MySQL Forums
Forum List  »  GIS

Create spatial index on BLOB column?
Posted by: James Allen
Date: August 15, 2009 03:50PM

Hi,

I am trying to add a spatial index to a table column named Location of type BLOB. If I try this:

ALTER TABLE route ADD SPATIAL INDEX(Location);

I get:

#Error: BLOB/TEXT column 'Location' used in key specification without a key length

But in the official docs for MySql 5.1 (the version I am using), it clearly says:

"In MySQL 5.1, column prefix lengths are prohibited. The full width of each column is indexed."

This surely says that I don't need to provide a prefix. I tried adding a prefix anyway like this:

ALTER TABLE route ADD SPATIAL INDEX(Location(256));

And I get:

#Error: Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys

So what the heck is going on?? For info, I am using MySQL 5.1.37 community, and my table is MyISAM, this is the create statement:

CREATE TABLE `climb`.`route` (
`Id` int(11) NOT NULL,
`Name` varchar(255) NOT NULL,
`Location` blob,
PRIMARY KEY (`Id`),
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Options: ReplyQuote


Subject
Views
Written By
Posted
Create spatial index on BLOB column?
6342
August 15, 2009 03:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.