Skip to content

Commit

Permalink
Bug #22486025 INNODB: FAILING ASSERTION: KEY_LEN != 0 || FIND_FLAG !=…
Browse files Browse the repository at this point in the history
… HA_READ_KEY_EXACT

This assertion basically comes because innodb doesn't support
index on zero length column.This problem comes only for
innodb intrinsic temporary table. It was decided that we will
presently return an error for the queries which build a
index on a zero length column . Supporting the index on
zero length column will be taken as a separate bug.
  • Loading branch information
Aditya A committed Nov 6, 2017
1 parent cdbd81d commit 1a13f7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions mysql-test/r/group_by.result
Original file line number Diff line number Diff line change
Expand Up @@ -2108,8 +2108,7 @@ SET BIG_TABLES=1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
1
1
ERROR 42000: The used storage engine can't index column 'tmp_field_0'
SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
1
1
Expand Down
1 change: 1 addition & 0 deletions mysql-test/t/group_by.test
Original file line number Diff line number Diff line change
Expand Up @@ -1374,6 +1374,7 @@ DROP TABLE t1;
SET BIG_TABLES=1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (0),(0);
--error ER_WRONG_KEY_COLUMN
SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
Expand Down
6 changes: 6 additions & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10354,6 +10354,12 @@ create_index(
/* Assert that "GEN_CLUST_INDEX" cannot be used as non-primary index */
ut_a(innobase_strcasecmp(key->name, innobase_index_reserve_name) != 0);

if(key->key_length == 0) {
my_error(ER_WRONG_KEY_COLUMN,
MYF(0),
key->key_part->field->field_name);
DBUG_RETURN(ER_WRONG_KEY_COLUMN);
}
ind_type = 0;
if (key->flags & HA_SPATIAL) {
ind_type = DICT_SPATIAL;
Expand Down

0 comments on commit 1a13f7f

Please sign in to comment.