Skip to content

Commit b9bc3c2

Browse files
committed
Merge branch '5.5' into 10.0
2 parents b3c320b + 43c393f commit b9bc3c2

File tree

11 files changed

+99
-16
lines changed

11 files changed

+99
-16
lines changed

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ sub command_line_setup {
14631463

14641464
foreach my $fs (@tmpfs_locations)
14651465
{
1466-
if ( -d $fs && ! -l $fs )
1466+
if ( -d $fs && ! -l $fs && -w $fs )
14671467
{
14681468
my $template= "var_${opt_build_thread}_XXXX";
14691469
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);

mysql-test/r/join.result

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,11 +1516,13 @@ ERROR 42S22: Unknown column 'f' in 'from clause'
15161516
DROP TABLE t;
15171517
CREATE TABLE t (f INT);
15181518
CALL p;
1519-
ERROR 42S22: Unknown column 'f' in 'from clause'
1519+
f
15201520
DROP TABLE t;
15211521
CREATE TABLE t (i INT);
15221522
CALL p;
1523-
ERROR 42S22: Unknown column 'f' in 'from clause'
1523+
ERROR 42S22: Unknown column 't1.f' in 'field list'
1524+
CALL p;
1525+
ERROR 42S22: Unknown column 't1.f' in 'field list'
15241526
DROP PROCEDURE p;
15251527
DROP TABLE t;
15261528
CREATE TABLE t1 (a INT, b INT);

mysql-test/r/sp.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7898,6 +7898,23 @@ SET S.CLOSE_YN = ''
78987898
where 1=1;
78997899
drop function if exists f1;
79007900
drop table t1,t2;
7901+
#
7902+
# MDEV-16957: Server crashes in Field_iterator_natural_join::next
7903+
# upon 2nd execution of SP
7904+
#
7905+
CREATE TABLE t1 (a INT, b VARCHAR(32));
7906+
CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
7907+
CALL sp;
7908+
ERROR 42S22: Unknown column 'c' in 'from clause'
7909+
CALL sp;
7910+
ERROR 42S22: Unknown column 'c' in 'from clause'
7911+
CALL sp;
7912+
ERROR 42S22: Unknown column 'c' in 'from clause'
7913+
alter table t1 add column c int;
7914+
CALL sp;
7915+
c a b a b
7916+
DROP PROCEDURE sp;
7917+
DROP TABLE t1;
79017918
# End of 5.5 test
79027919
#
79037920
# MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2

mysql-test/suite/maria/maria.result

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2732,6 +2732,10 @@ id name
27322732
-1 dog
27332733
2 cat
27342734
DROP TABLE t1;
2735+
CREATE TABLE t1 (pk int, i2 int) ENGINE=Aria;
2736+
INSERT INTO t1 VALUES (1,2), (2,3),(3,4);
2737+
DELETE FROM tt.*, t1.* USING t1 AS tt LEFT JOIN t1 ON (tt.i2 = t1.pk);
2738+
DROP TABLE t1;
27352739
#
27362740
# End of 5.5 tests
27372741
#

mysql-test/suite/maria/maria.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,16 @@ INSERT INTO t1 (name) VALUES ('cat');
20022002
SELECT * FROM t1;
20032003
DROP TABLE t1;
20042004

2005+
#
2006+
# MDEV-16682
2007+
# Assertion `(buff[7] & 7) == HEAD_PAGE' failed.
2008+
#
2009+
2010+
CREATE TABLE t1 (pk int, i2 int) ENGINE=Aria;
2011+
INSERT INTO t1 VALUES (1,2), (2,3),(3,4);
2012+
DELETE FROM tt.*, t1.* USING t1 AS tt LEFT JOIN t1 ON (tt.i2 = t1.pk);
2013+
DROP TABLE t1;
2014+
20052015
--echo #
20062016
--echo # End of 5.5 tests
20072017
--echo #

mysql-test/t/join.test

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,12 +1185,13 @@ CREATE TABLE t (f INT);
11851185
#
11861186
# The following shouldn't fail as the table is now matching the using
11871187
#
1188-
--error ER_BAD_FIELD_ERROR
11891188
CALL p;
11901189
DROP TABLE t;
11911190
CREATE TABLE t (i INT);
11921191
--error ER_BAD_FIELD_ERROR
11931192
CALL p;
1193+
--error ER_BAD_FIELD_ERROR
1194+
CALL p;
11941195
DROP PROCEDURE p;
11951196
DROP TABLE t;
11961197

mysql-test/t/sp.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9353,6 +9353,27 @@ where 1=1;
93539353
drop function if exists f1;
93549354
drop table t1,t2;
93559355

9356+
--echo #
9357+
--echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next
9358+
--echo # upon 2nd execution of SP
9359+
--echo #
9360+
9361+
CREATE TABLE t1 (a INT, b VARCHAR(32));
9362+
CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
9363+
--error ER_BAD_FIELD_ERROR
9364+
CALL sp;
9365+
--error ER_BAD_FIELD_ERROR
9366+
CALL sp;
9367+
--error ER_BAD_FIELD_ERROR
9368+
CALL sp;
9369+
alter table t1 add column c int;
9370+
CALL sp;
9371+
9372+
# Cleanup
9373+
DROP PROCEDURE sp;
9374+
DROP TABLE t1;
9375+
9376+
93569377
--echo # End of 5.5 test
93579378

93589379
--echo #

sql/item.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8707,13 +8707,11 @@ void Item_trigger_field::cleanup()
87078707

87088708
Item_result item_cmp_type(Item_result a,Item_result b)
87098709
{
8710-
if (a == STRING_RESULT && b == STRING_RESULT)
8711-
return STRING_RESULT;
8712-
if (a == INT_RESULT && b == INT_RESULT)
8713-
return INT_RESULT;
8714-
else if (a == ROW_RESULT || b == ROW_RESULT)
8710+
if (a == b)
8711+
return a;
8712+
if (a == ROW_RESULT || b == ROW_RESULT)
87158713
return ROW_RESULT;
8716-
else if (a == TIME_RESULT || b == TIME_RESULT)
8714+
if (a == TIME_RESULT || b == TIME_RESULT)
87178715
return TIME_RESULT;
87188716
if ((a == INT_RESULT || a == DECIMAL_RESULT) &&
87198717
(b == INT_RESULT || b == DECIMAL_RESULT))

sql/sql_base.cc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7465,10 +7465,22 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
74657465

74667466
result= FALSE;
74677467

7468-
err:
74697468
if (arena)
74707469
thd->restore_active_arena(arena, &backup);
74717470
DBUG_RETURN(result);
7471+
7472+
err:
7473+
/*
7474+
Actually we failed to build join columns list, so we have to
7475+
clear it to avoid problems with half-build join on next run.
7476+
The list was created in mark_common_columns().
7477+
*/
7478+
table_ref_1->remove_join_columns();
7479+
table_ref_2->remove_join_columns();
7480+
7481+
if (arena)
7482+
thd->restore_active_arena(arena, &backup);
7483+
DBUG_RETURN(TRUE);
74727484
}
74737485

74747486

sql/table.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,16 @@ struct TABLE_LIST
22832283
}
22842284
void set_lock_type(THD* thd, enum thr_lock_type lock);
22852285

2286+
void remove_join_columns()
2287+
{
2288+
if (join_columns)
2289+
{
2290+
join_columns->empty();
2291+
join_columns= NULL;
2292+
is_join_columns_complete= FALSE;
2293+
}
2294+
}
2295+
22862296
private:
22872297
bool prep_check_option(THD *thd, uint8 check_opt_type);
22882298
bool prep_where(THD *thd, Item **conds, bool no_where_clause);

0 commit comments

Comments
 (0)