Skip to content

Commit

Permalink
MDEV-13776 mysqld got signal 11 on delete returning
Browse files Browse the repository at this point in the history
The method Field_iterator_table::create_item() must take into
account that it can be called when processing DELETE RETURNING.
  • Loading branch information
igorbabaev committed Oct 23, 2017
1 parent acb336f commit a1a79aa
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions mysql-test/r/delete_returning.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
15 changes: 15 additions & 0 deletions mysql-test/t/delete_returning.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
3 changes: 2 additions & 1 deletion sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a1a79aa

Please sign in to comment.