Skip to content

Commit 4a8a6f6

Browse files
committed
MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT
same as MDEV-26412, but in CREATE...SELECT. fix: apply 39feab3 to create rule too.
1 parent a2bcfa6 commit 4a8a6f6

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

mysql-test/main/insert.result

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,4 +770,12 @@ create table t (a int);
770770
select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0)));
771771
ERROR 42S22: Unknown column 't1.a' in 'on clause'
772772
drop table t;
773+
#
774+
# MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT
775+
#
776+
create table t1 (i int) ;
777+
create table t2 (j int) ;
778+
create table t4 select * from t1 join t2 on (select t3.i);
779+
ERROR 42S22: Unknown column 't3.i' in 'field list'
780+
drop table t1, t2;
773781
# End of 10.4 tests

mysql-test/main/insert.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,4 +638,13 @@ create table t (a int);
638638
select 1 in (select count(*) from t t1 join (t t2 join t t3 on (t1.a != 0)));
639639
drop table t;
640640

641+
--echo #
642+
--echo # MDEV-28578 Server crashes in Item_field::fix_outer_field after CREATE SELECT
643+
--echo #
644+
create table t1 (i int) ;
645+
create table t2 (j int) ;
646+
--error ER_BAD_FIELD_ERROR
647+
create table t4 select * from t1 join t2 on (select t3.i);
648+
drop table t1, t2;
649+
641650
--echo # End of 10.4 tests

sql/sql_yacc.yy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2693,6 +2693,7 @@ create:
26932693
lex->create_info.default_table_charset= NULL;
26942694
lex->name= null_clex_str;
26952695
lex->create_last_non_select_table= lex->last_table();
2696+
lex->inc_select_stack_outer_barrier();
26962697
}
26972698
create_body
26982699
{

0 commit comments

Comments
 (0)