Skip to content

Commit

Permalink
Merge mariadb-10.5.15 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Feb 14, 2022
2 parents 1557204 + 9aa3564 commit 6405ed6
Show file tree
Hide file tree
Showing 23 changed files with 5,567 additions and 33 deletions.
26 changes: 11 additions & 15 deletions client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ static struct my_option my_long_options[]=
&opt_not_used, &opt_not_used, 0 , GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#define PASSWORD_OPT 12
{"password", 'p',
"Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password,
Expand Down Expand Up @@ -154,7 +153,6 @@ static struct my_option my_long_options[]=
{"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.",
&opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#define USER_OPT (array_elements(my_long_options) - 6)
{"user", 'u', "User for login.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Display more output about the process; Using it twice will print connection argument; Using it 3 times will print out all CHECK, RENAME and ALTER TABLE during the check phase.",
Expand Down Expand Up @@ -262,11 +260,11 @@ static void print_error(const char *error_msg, DYNAMIC_STRING *output)
*/

static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
const char *name,
const char *arg)
{
dynstr_append(ds, "--");
dynstr_append(ds, opt->name);
dynstr_append(ds, name);
if (arg)
{
dynstr_append(ds, "=");
Expand All @@ -276,10 +274,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
}

static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
const struct my_option *opt,
const char* arg)
const char *name,
const char *arg)
{
dynstr_append(ds, opt->name);
dynstr_append(ds, name);
if (arg)
{
dynstr_append(ds, "=");
Expand Down Expand Up @@ -327,7 +325,7 @@ get_one_option(const struct my_option *opt, const char *argument,
*/
char *start= (char*) argument;
/* Add password to ds_args before overwriting the arg with x's */
add_one_option_cnf_file(&ds_args, opt, argument);
add_one_option_cnf_file(&ds_args, opt->name, argument);
while (*argument)
*(char*)argument++= 'x'; /* Destroy argument */
if (*start)
Expand Down Expand Up @@ -387,7 +385,7 @@ get_one_option(const struct my_option *opt, const char *argument,
case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */
add_one_option_cmd_line(&conn_args, opt, argument);
add_one_option_cmd_line(&conn_args, opt->name, argument);
break;
}

Expand All @@ -398,7 +396,7 @@ get_one_option(const struct my_option *opt, const char *argument,
it can be passed on to "mysql" and "mysqlcheck"
Save it in the ds_args string
*/
add_one_option_cnf_file(&ds_args, opt, argument);
add_one_option_cnf_file(&ds_args, opt->name, argument);
}
return 0;
}
Expand Down Expand Up @@ -1435,12 +1433,10 @@ int main(int argc, char **argv)
{
opt_password= get_tty_password(NullS);
/* add password to defaults file */
add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
add_one_option_cnf_file(&ds_args, "password", opt_password);
}
/* add user to defaults file */
add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
add_one_option_cnf_file(&ds_args, "user", opt_user);

cnf_file_path= strmov(defaults_file, "--defaults-file=");
{
Expand Down
33 changes: 33 additions & 0 deletions mysql-test/main/cte_nonrecursive.result
Original file line number Diff line number Diff line change
Expand Up @@ -2185,6 +2185,39 @@ select * from t1;
a
7
drop table t1,t2;
#
# MDEV-25766: Unused CTE lead to a crash in
# find_field_in_tables/find_order_in_list
#
create table t1 (f1 INTEGER);
create view v1 as
select
subq_0.c4 as c2,
subq_0.c4 as c4
from
(select
ref_0.f1 as c4
from
t1 as ref_0
where (select 1)
) as subq_0
order by c2, c4 desc;
WITH
unused_with AS (select
subq_0.c4 as c6
from
(select
11 as c4
from
v1 as ref_0
) as subq_0,
v1 as ref_2
)
select 1 ;
1
1
drop view v1;
drop table t1;
# End of 10.2 tests
#
# MDEV-21673: several references to CTE that uses
Expand Down
36 changes: 36 additions & 0 deletions mysql-test/main/cte_nonrecursive.test
Original file line number Diff line number Diff line change
Expand Up @@ -1637,6 +1637,42 @@ select * from t1;

drop table t1,t2;

--echo #
--echo # MDEV-25766: Unused CTE lead to a crash in
--echo # find_field_in_tables/find_order_in_list
--echo #

create table t1 (f1 INTEGER);

create view v1 as
select
subq_0.c4 as c2,
subq_0.c4 as c4
from
(select
ref_0.f1 as c4
from
t1 as ref_0
where (select 1)
) as subq_0
order by c2, c4 desc;

WITH
unused_with AS (select
subq_0.c4 as c6
from
(select
11 as c4
from
v1 as ref_0
) as subq_0,
v1 as ref_2
)
select 1 ;

drop view v1;
drop table t1;

--echo # End of 10.2 tests

--echo #
Expand Down
4 changes: 3 additions & 1 deletion mysql-test/main/subselect4.result
Original file line number Diff line number Diff line change
Expand Up @@ -1358,6 +1358,8 @@ INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0);
CREATE TABLE t3 (f4 int,KEY (f4)) ;
INSERT IGNORE INTO t3 VALUES (0),(0);
set @@optimizer_switch='semijoin=off';
# NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY'
# for line with id=2, see MDEV-27794.
EXPLAIN
SELECT * FROM t1 WHERE
(SELECT f2 FROM t2
Expand All @@ -1367,7 +1369,7 @@ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
GROUP BY SQ1_t1.f4));
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
3 SUBQUERY SQ1_t3 range f4 f4 5 NULL 2 Using where; Using index; Using temporary
3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 WHERE
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/subselect4.test
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,8 @@ INSERT IGNORE INTO t3 VALUES (0),(0);

set @@optimizer_switch='semijoin=off';

--echo # NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY'
--echo # for line with id=2, see MDEV-27794.
EXPLAIN
SELECT * FROM t1 WHERE
(SELECT f2 FROM t2
Expand Down
Loading

0 comments on commit 6405ed6

Please sign in to comment.