MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up...
- When INSERT catches an error, it should not attempt to send parts of EXPLAIN output.
This commit is contained in:
parent
a1705b762e
commit
3e8f7c8516
@ -198,3 +198,24 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
3 SUBQUERY t1 index NULL a 5 NULL 3 Using index
|
3 SUBQUERY t1 index NULL a 5 NULL 3 Using index
|
||||||
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up on unique key violation
|
||||||
|
#
|
||||||
|
drop table if exists t1;
|
||||||
|
Warnings:
|
||||||
|
Note 1051 Unknown table 't1'
|
||||||
|
drop function if exists f1;
|
||||||
|
create table t1 (a int, unique(a));
|
||||||
|
create function f1(x int)
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
insert into t1 values(x),(x);
|
||||||
|
return 10;
|
||||||
|
end|
|
||||||
|
select f1(100);
|
||||||
|
ERROR 23000: Duplicate entry '100' for key 'a'
|
||||||
|
select 'OK';
|
||||||
|
OK
|
||||||
|
OK
|
||||||
|
drop function f1;
|
||||||
|
drop table t1;
|
||||||
|
@ -169,3 +169,32 @@ explain insert into t2 values
|
|||||||
(11, 1+(select max(a+1) from t1));
|
(11, 1+(select max(a+1) from t1));
|
||||||
|
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-5122: "Commands out of sync", "Malformed packet" or client hang up on unique key violation
|
||||||
|
--echo #
|
||||||
|
drop table if exists t1;
|
||||||
|
|
||||||
|
--disable_warnings
|
||||||
|
drop function if exists f1;
|
||||||
|
--enable_warnings
|
||||||
|
|
||||||
|
create table t1 (a int, unique(a));
|
||||||
|
|
||||||
|
delimiter |;
|
||||||
|
create function f1(x int)
|
||||||
|
returns int
|
||||||
|
begin
|
||||||
|
insert into t1 values(x),(x);
|
||||||
|
return 10;
|
||||||
|
end|
|
||||||
|
delimiter ;|
|
||||||
|
|
||||||
|
--error ER_DUP_ENTRY
|
||||||
|
select f1(100);
|
||||||
|
select 'OK';
|
||||||
|
|
||||||
|
drop function f1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
@ -819,8 +819,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
save_insert_query_plan(thd, table_list);
|
save_insert_query_plan(thd, table_list);
|
||||||
if (thd->lex->describe)
|
if (thd->lex->describe)
|
||||||
{
|
{
|
||||||
retval= 0;
|
retval= thd->lex->explain->send_explain(thd);
|
||||||
goto exit_without_my_ok;
|
goto free_and_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1170,15 +1170,14 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
|
|
||||||
abort:
|
abort:
|
||||||
exit_without_my_ok:
|
|
||||||
#ifndef EMBEDDED_LIBRARY
|
#ifndef EMBEDDED_LIBRARY
|
||||||
if (lock_type == TL_WRITE_DELAYED)
|
if (lock_type == TL_WRITE_DELAYED)
|
||||||
end_delayed_insert(thd);
|
end_delayed_insert(thd);
|
||||||
#endif
|
#endif
|
||||||
if (table != NULL)
|
if (table != NULL)
|
||||||
table->file->ha_release_auto_increment();
|
table->file->ha_release_auto_increment();
|
||||||
retval= thd->lex->explain->send_explain(thd);
|
|
||||||
|
|
||||||
|
free_and_exit:
|
||||||
if (!joins_freed)
|
if (!joins_freed)
|
||||||
free_underlaid_joins(thd, &thd->lex->select_lex);
|
free_underlaid_joins(thd, &thd->lex->select_lex);
|
||||||
thd->abort_on_warning= 0;
|
thd->abort_on_warning= 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user