Skip to content
Permalink
Browse files
Merge branch '10.1' into 10.2
  • Loading branch information
vuvova committed Jul 8, 2017
2 parents 5789934 + 9e11e05 commit c980113
Show file tree
Hide file tree
Showing 32 changed files with 776 additions and 244 deletions.
@@ -4805,10 +4805,11 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "Protocol:\t\tCompressed\n");
#endif

if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0])
const char *pos;
if ((status_str= mysql_stat(&mysql)) && !mysql_error(&mysql)[0] &&
(pos= strchr(status_str,' ')))
{
ulong sec;
const char *pos= strchr(status_str,' ');
/* print label */
tee_fprintf(stdout, "%.*s\t\t\t", (int) (pos-status_str), status_str);
if ((status_str= str2int(pos,10,0,LONG_MAX,(long*) &sec)))
@@ -1171,6 +1171,8 @@ int main(int argc, char **argv)
{
int fd= create_temp_file(cnf_file_path, opt_tmpdir[0] ? opt_tmpdir : NULL,
"mysql_upgrade-", O_CREAT | O_WRONLY, MYF(MY_FAE));
if (fd < 0)
die(NULL);
my_write(fd, USTRING_WITH_LEN( "[client]\n"), MYF(MY_FAE));
my_write(fd, (uchar*)ds_args.str, ds_args.length, MYF(MY_FAE));
my_close(fd, MYF(0));
@@ -92,8 +92,7 @@

static void add_load_option(DYNAMIC_STRING *str, const char *option,
const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, size_t length,
char **err_pos, uint *err_len);
static ulong find_set(TYPELIB *, const char *, size_t, char **, uint *);
static char *alloc_query_str(ulong size);

static void field_escape(DYNAMIC_STRING* in, const char *from);
@@ -5485,7 +5484,7 @@ static ulong find_set(TYPELIB *lib, const char *x, size_t length,
var_len= (uint) (pos - start);
strmake(buff, start, MY_MIN(sizeof(buff) - 1, var_len));
find= find_type(buff, lib, FIND_TYPE_BASIC);
if (!find)
if (find <= 0)
{
*err_pos= (char*) start;
*err_len= var_len;
@@ -677,7 +677,7 @@ int main(int argc, char **argv)
MYF(0))))
return -2;

for (counter= 0; *argv != NULL; argv++) /* Loop through tables */
for (; *argv != NULL; argv++) /* Loop through tables */
{
pthread_mutex_lock(&counter_mutex);
while (counter == opt_use_threads)
@@ -602,7 +602,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query,
void str_to_file(const char *fname, char *str, int size);
void str_to_file2(const char *fname, char *str, int size, my_bool append);

void fix_win_paths(char *val, int len);
void fix_win_paths(char *val, size_t len);
const char *get_errname_from_code (uint error_code);
int multi_reg_replace(struct st_replace_regex* r,char* val);

@@ -2652,6 +2652,7 @@ void var_query_set(VAR *var, const char *query, const char** query_end)
if (!mysql)
{
struct st_command command;
DBUG_ASSERT(query_end);
memset(&command, 0, sizeof(command));
command.query= (char*)query;
command.first_word_len= (*query_end - query);
@@ -7468,7 +7469,7 @@ void free_win_path_patterns()
=> all \ from c:\mysql\m... until next space is converted into /
*/

void fix_win_paths(char *val, int len)
void fix_win_paths(char *val, size_t len)
{
#ifdef _WIN32
uint i;
@@ -4706,7 +4706,7 @@ pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
# End of 5.0 tests.
create table t_out (subcase char(3),
a1 char(2), b1 char(2), c1 char(2));
create table t_in (a2 char(2), b2 char(2), c2 char(2));
@@ -5581,7 +5581,7 @@ insert into t2 values ('x'), ('y');
select * from t2 where a=(select a from t1) and a='x';
ERROR 21000: Subquery returns more than 1 row
drop table t1,t2;
End of 5.1 tests
# End of 5.1 tests
#
# Bug #11765713 58705:
# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
@@ -6193,7 +6193,7 @@ WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
# End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
#
@@ -7150,19 +7150,21 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
ERROR 42000: Can't group on 'sq'
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
ERROR 42000: Can't group on 'sq'
drop view v2;
drop table t1,t2;
#
@@ -7177,6 +7179,29 @@ f1 f2
foo bar
DROP TABLE t1;
#
# MDEV-10146: Wrong result (or questionable result and behavior)
# with aggregate function in uncorrelated SELECT subquery
#
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
( SELECT MAX(f1) FROM t2 )
2
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
( SELECT MAX(f1) FROM t2 )
2
INSERT INTO t2 VALUES (4);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
ERROR 21000: Subquery returns more than 1 row
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
# with UNION in ALL subquery
#
@@ -7203,7 +7228,7 @@ SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
# End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
@@ -7217,4 +7242,4 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
# End of 10.2 tests
@@ -4708,7 +4708,7 @@ pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
# End of 5.0 tests.
create table t_out (subcase char(3),
a1 char(2), b1 char(2), c1 char(2));
create table t_in (a2 char(2), b2 char(2), c2 char(2));
@@ -5583,7 +5583,7 @@ insert into t2 values ('x'), ('y');
select * from t2 where a=(select a from t1) and a='x';
ERROR 21000: Subquery returns more than 1 row
drop table t1,t2;
End of 5.1 tests
# End of 5.1 tests
#
# Bug #11765713 58705:
# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
@@ -6193,7 +6193,7 @@ WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
# End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
#
@@ -7150,19 +7150,21 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
ERROR 42000: Can't group on 'sq'
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
ERROR 42000: Can't group on 'sq'
drop view v2;
drop table t1,t2;
#
@@ -7177,6 +7179,29 @@ f1 f2
foo bar
DROP TABLE t1;
#
# MDEV-10146: Wrong result (or questionable result and behavior)
# with aggregate function in uncorrelated SELECT subquery
#
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
( SELECT MAX(f1) FROM t2 )
2
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
( SELECT MAX(f1) FROM t2 )
2
INSERT INTO t2 VALUES (4);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
ERROR 21000: Subquery returns more than 1 row
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
# with UNION in ALL subquery
#
@@ -7203,7 +7228,7 @@ SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
# End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
@@ -7217,7 +7242,7 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'
@@ -4706,7 +4706,7 @@ pk
SET SESSION sql_mode=@old_sql_mode;
drop table t2, t1;
drop view v1;
End of 5.0 tests.
# End of 5.0 tests.
create table t_out (subcase char(3),
a1 char(2), b1 char(2), c1 char(2));
create table t_in (a2 char(2), b2 char(2), c2 char(2));
@@ -5581,7 +5581,7 @@ insert into t2 values ('x'), ('y');
select * from t2 where a=(select a from t1) and a='x';
ERROR 21000: Subquery returns more than 1 row
drop table t1,t2;
End of 5.1 tests
# End of 5.1 tests
#
# Bug #11765713 58705:
# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
@@ -6188,7 +6188,7 @@ WHERE (c_sq1_alias1.col_int_nokey != @var2
OR c_sq1_alias1.pk != @var3)) ) AS alias3;
pk col_int_nokey col_int_key col_time_key col_varchar_key col_varchar_nokey
DROP TABLE t1,t2;
End of 5.2 tests
# End of 5.2 tests
#
# BUG#779885: Crash in eliminate_item_equal with materialization=on in
#
@@ -7143,19 +7143,21 @@ INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 INT, KEY(f2));
INSERT INTO t2 VALUES (3);
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
3
ERROR 42000: Can't group on 'sq'
SELECT * FROM v2 where ( SELECT MIN(v2.f2) FROM t1 ) > 0;
f2
3
SELECT count(*) FROM v2 group by ( SELECT MIN(v2.f2) FROM t1 );
count(*)
1
delete from t1;
SELECT ( SELECT MIN(t2.f2) FROM t1 ) AS sq FROM t2 GROUP BY sq;
ERROR 42000: Can't group on 'sq'
SELECT ( SELECT MIN(v2.f2) FROM t1 ) AS sq FROM v2 GROUP BY sq;
sq
NULL
ERROR 42000: Can't group on 'sq'
drop view v2;
drop table t1,t2;
#
@@ -7170,6 +7172,29 @@ f1 f2
foo bar
DROP TABLE t1;
#
# MDEV-10146: Wrong result (or questionable result and behavior)
# with aggregate function in uncorrelated SELECT subquery
#
CREATE TABLE t1 (f1 INT);
CREATE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f2 int);
INSERT INTO t2 VALUES (3);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
( SELECT MAX(f1) FROM t2 )
2
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
( SELECT MAX(f1) FROM t2 )
2
INSERT INTO t2 VALUES (4);
SELECT ( SELECT MAX(f1) FROM t2 ) FROM v1;
ERROR 21000: Subquery returns more than 1 row
SELECT ( SELECT MAX(f1) FROM t2 ) FROM t1;
ERROR 21000: Subquery returns more than 1 row
drop view v1;
drop table t1,t2;
# End of 10.0 tests
#
# MDEV-9487: Server crashes in Time_and_counter_tracker::incr_loops
# with UNION in ALL subquery
#
@@ -7196,7 +7221,7 @@ SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo');
f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
# End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
@@ -7210,7 +7235,7 @@ WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
# End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'

0 comments on commit c980113

Please sign in to comment.