Warning: using a partial-field key prefix in search.

Kevin Day <[email protected]>
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>

I've got a query that worked in 3.23 but doesn't in 4.1.1:


mysql> CREATE TABLE `h` (
     ->   `p` int(11) unsigned NOT NULL auto_increment,
     ->   `c` smallint(11) unsigned NOT NULL default '0',
     ->   `s` smallint(11) NOT NULL default '0',
     ->   PRIMARY KEY  (`p`),
     ->   KEY `c` (`c`),
     ->   KEY `s` (`s`),
     ->   KEY `cs` (`c`,`s`)
     -> ) TYPE=InnoDB DEFAULT CHARSET=latin1
     -> ;
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT * FROM h use index (cs) WHERE c=1941 AND s>=0 ORDER BY p 
DESC LIMIT 0,13
     -> ;
040307  6:32:39  InnoDB: Warning: using a partial-field key prefix in 
search.
InnoDB: Table name test/h, index name PRIMARY. Last data field length 4 
bytes,
InnoDB: key ptr now exceeds key end by 2 bytes.
InnoDB: Key value in the MySQL format:
  len 2; hex 9507; asc ;
Empty set (0.00 sec)


It returns an empty set no matter what data should have been returned. 
Removing the "use index" seems to fix it. It seems intermittent though, 
sometimes it DOES work and I can't find any pattern.

Anyone bumped into this before?


-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.