Bug #34775 federated died in ha_federated::create_where_from_key
Submitted: 23 Feb 2008 11:14 Modified: 19 Mar 2008 17:50
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Federated storage engine Severity:S1 (Critical)
Version:5.0.56, 5.1.23 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[23 Feb 2008 11:14] Shane Bester
Description:
mysqld.exe!ha_federated::create_where_from_key
mysqld.exe!ha_federated::read_range_first
mysqld.exe!handler::read_multi_range_first
mysqld.exe!QUICK_RANGE_SELECT::get_next
mysqld.exe!rr_quick
mysqld.exe!join_init_read_record
mysqld.exe!sub_select
mysqld.exe!do_select
mysqld.exe!JOIN::exec
mysqld.exe!mysql_select
mysqld.exe!handle_select
mysqld.exe!execute_sqlcom_select
mysqld.exe!mysql_execute_command
mysqld.exe!mysql_parse
mysqld.exe!dispatch_command
mysqld.exe!do_command
mysqld.exe!handle_one_connection
mysqld.exe!pthread_start
mysqld.exe!_callthreadstart
mysqld.exe!_threadstart

Field *field= key_part->field;
uint store_length= key_part->store_length;
uint part_length= min(store_length, length);
needs_quotes= field->str_needs_quotes(); <---crash

field ptr is 0xa5a5a5a5 (uninitialized memory)

How to repeat:
create database if not exists `realdb`;
create database if not exists `test`;
drop table if exists `test`.`t0`;
drop table if exists `realdb`.`t0`;
create table `realdb`.`t0`(`a` mediumint(9) default null,key(`a`))engine=myisam;
create table `test`.`t0`(`a` mediumint(9) default null,key(`a`))engine=federated connection='mysql://root@127.0.0.1:3306/realdb/t0';
insert into `realdb`.`t0` values (1),(2);
select 1 from `t0` where `a` <= 1;
[23 Feb 2008 11:24] MySQL Verification Team
this bug has a variety of manifestations.  depending on the query, we sometimes have assertions and a deeper stack trace:

Assertion failed: !table || (!table->read_set || bitmap_is_set(table->read_set, field_index)), file .\field.cc, line 2757

Assertion failed: remainder > 1, file .\ha_federated.cc, line 1409
[23 Feb 2008 14:46] Valeriy Kravchuk
Thank you for a bug report. Verified just as described.
[19 Mar 2008 17:50] Sergey Vojtovich
A duplicate of BUG#33946.