This is expected behaviour; the server parses the SQL before the storage engine takes any action on it, so the statement must still be a valid one. Example:
1. The MySQL server reads this statement, sees it is valid, so it's OK to execute; then it executes the statement, and NDB ignores that part of it:
mysql> create table t ( c1 int not null, c2 varchar(100), index i1 (c2(50)) )engine=ndb;
Query OK, 0 rows affected (0.79 sec)
mysql> show create table t\G
*************************** 1. row ***************************
Table: t
Create Table: CREATE TABLE `t` (
`c1` int(11) NOT NULL,
`c2` varchar(100) DEFAULT NULL,
KEY `i1` (`c2`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
2. The MySQL server attempts to parse the following statement, which is invalid; it rejects the statement with an error, and never tries to execute it:
mysql> create table t1 ( c1 int not null, c2 varchar(100), index i1 (c2(500)) )engine=ndb;
ERROR 1089 (HY000): 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
mysql>
That being said, I'll take a look at the documentation and see if we can't make that a bit clearer. Thanks!
Jon Stephens
MySQL Documentation Team @ Oracle
MySQL Dev Zone
MySQL Server Documentation
Oracle