Commit ca733d03 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-15729 Server crashes in Field::make_field upon HANDLER READ executed with PS protocol

update table->pos_in_table_list during prepare,
just like it's done in normal execution.

otherwise it'll be a dangling pointer
parent 6da81921
create table t1 (i int);
handler test.t1 open handler_a;
flush status;
handler handler_a read first;
i
show status like 'Com_stmt_prepare%';
Variable_name Value
Com_stmt_prepare OK
drop table t1;
#
# MDEV-15729 Server crashes in Field::make_field upon HANDLER READ executed with PS protocol
#
create table t1 (i int);
handler test.t1 open handler_a;
flush status;
handler handler_a read first;
# handler...read must be prepared in --ps-protocol mode
--replace_result $PS_PROTOCOL OK
show status like 'Com_stmt_prepare%';
drop table t1;
...@@ -980,6 +980,7 @@ SQL_HANDLER *mysql_ha_read_prepare(THD *thd, TABLE_LIST *tables, ...@@ -980,6 +980,7 @@ SQL_HANDLER *mysql_ha_read_prepare(THD *thd, TABLE_LIST *tables,
if (!(handler= mysql_ha_find_handler(thd, tables->alias))) if (!(handler= mysql_ha_find_handler(thd, tables->alias)))
DBUG_RETURN(0); DBUG_RETURN(0);
tables->table= handler->table; // This is used by fix_fields tables->table= handler->table; // This is used by fix_fields
handler->table->pos_in_table_list= tables;
if (mysql_ha_fix_cond_and_key(handler, mode, keyname, key_expr, cond, 1)) if (mysql_ha_fix_cond_and_key(handler, mode, keyname, key_expr, cond, 1))
DBUG_RETURN(0); DBUG_RETURN(0);
DBUG_RETURN(handler); DBUG_RETURN(handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment