Commit a1a79aa5 authored by Igor Babaev's avatar Igor Babaev

MDEV-13776 mysqld got signal 11 on delete returning

The method Field_iterator_table::create_item() must take into
account that it can be called when processing DELETE RETURNING.
parent acb336f7
......@@ -199,3 +199,15 @@ i
2
DROP PROCEDURE p1;
DROP TABLE t1;
#
# MDEV-13776: DELETE ... RETURNING with sql_mode='ONLY_FULL_GROUP_BY'
#
set @sql_mode_save= @@sql_mode;
set sql_mode='ONLY_FULL_GROUP_BY';
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUE(1),(2),(3);
DELETE FROM t1 WHERE id > 2 RETURNING *;
id
3
set sql_mode=@sql_mode_save;
DROP TABLE t1;
......@@ -155,3 +155,18 @@ SELECT * FROM t1;
DROP PROCEDURE p1;
DROP TABLE t1;
--echo #
--echo # MDEV-13776: DELETE ... RETURNING with sql_mode='ONLY_FULL_GROUP_BY'
--echo #
set @sql_mode_save= @@sql_mode;
set sql_mode='ONLY_FULL_GROUP_BY';
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUE(1),(2),(3);
DELETE FROM t1 WHERE id > 2 RETURNING *;
set sql_mode=@sql_mode_save;
DROP TABLE t1;
......@@ -5260,7 +5260,8 @@ Item *Field_iterator_table::create_item(THD *thd)
Item_field *item= new Item_field(thd, &select->context, *ptr);
if (item && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
!thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS)
!thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS &&
select->join)
{
select->join->non_agg_fields.push_back(item);
item->marker= select->cur_pos_in_select_list;
......
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