Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions mysql-test/main/create_select.result
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,16 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1, t2;
# End of 12.1 tests
#
# MDEV-36990: SIGFPE in get_max_range_rowid_filter_elems_for_table
#
DROP TABLE IF EXISTS t;
Warnings:
Note 1051 Unknown table 'test.t'
CREATE TABLE t (a INT,b INT,PRIMARY KEY(a),INDEX (b))Engine=InnoDB;
ALTER TABLE t CHANGE COLUMN a a BINARY (0);
ERROR 42000: The storage engine InnoDB can't index column `a`
SELECT * FROM t WHERE b>-1;
a b
DROP TABLE IF EXISTS t;
End of 10.11 tests
13 changes: 13 additions & 0 deletions mysql-test/main/create_select.test
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,16 @@ show create table t2;
drop table t1, t2;

--echo # End of 12.1 tests

--echo #
--echo # MDEV-36990: SIGFPE in get_max_range_rowid_filter_elems_for_table
--echo #

DROP TABLE IF EXISTS t;
CREATE TABLE t (a INT,b INT,PRIMARY KEY(a),INDEX (b))Engine=InnoDB;
--error ER_WRONG_KEY_COLUMN
ALTER TABLE t CHANGE COLUMN a a BINARY (0);
SELECT * FROM t WHERE b>-1;

DROP TABLE IF EXISTS t;
--echo End of 10.11 tests
4 changes: 2 additions & 2 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2963,8 +2963,8 @@ my_bool init_key_part_spec(THD *thd, Alter_info *alter_info,
else if (!(file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS))
key_part_length= kp.length;
}
else if (key_part_length == 0 && (column->flags & NOT_NULL_FLAG) &&
!*is_hash_field_needed)
else if (key_part_length == 0 && ((column->flags & NOT_NULL_FLAG)||
key.type == Key::PRIMARY) && !*is_hash_field_needed)
{
my_error(ER_WRONG_KEY_COLUMN, MYF(0), file->table_type(), field_name.str);
DBUG_RETURN(TRUE);
Expand Down