Skip to content

Commit b4477ae

Browse files
committed
Merge branch '10.3' into 10.4
2 parents 8a7776a + a36fc80 commit b4477ae

24 files changed

+5566
-39
lines changed

client/mysql_upgrade.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ static struct my_option my_long_options[]=
121121
&opt_not_used, &opt_not_used, 0 , GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
122122
{"host", 'h', "Connect to host.", 0,
123123
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
124-
#define PASSWORD_OPT 12
125124
{"password", 'p',
126125
"Password to use when connecting to server. If password is not given,"
127126
" it's solicited on the tty.", &opt_password,&opt_password,
@@ -153,7 +152,6 @@ static struct my_option my_long_options[]=
153152
{"upgrade-system-tables", 's', "Only upgrade the system tables in the mysql database. Tables in other databases are not checked or touched.",
154153
&opt_systables_only, &opt_systables_only, 0,
155154
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
156-
#define USER_OPT (array_elements(my_long_options) - 6)
157155
{"user", 'u', "User for login.", &opt_user,
158156
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
159157
{"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.",
@@ -260,11 +258,11 @@ static void print_error(const char *error_msg, DYNAMIC_STRING *output)
260258
*/
261259

262260
static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
263-
const struct my_option *opt,
264-
const char* arg)
261+
const char *name,
262+
const char *arg)
265263
{
266264
dynstr_append(ds, "--");
267-
dynstr_append(ds, opt->name);
265+
dynstr_append(ds, name);
268266
if (arg)
269267
{
270268
dynstr_append(ds, "=");
@@ -274,10 +272,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
274272
}
275273

276274
static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
277-
const struct my_option *opt,
278-
const char* arg)
275+
const char *name,
276+
const char *arg)
279277
{
280-
dynstr_append(ds, opt->name);
278+
dynstr_append(ds, name);
281279
if (arg)
282280
{
283281
dynstr_append(ds, "=");
@@ -320,7 +318,7 @@ get_one_option(int optid, const struct my_option *opt,
320318
if (argument)
321319
{
322320
/* Add password to ds_args before overwriting the arg with x's */
323-
add_one_option_cnf_file(&ds_args, opt, argument);
321+
add_one_option_cnf_file(&ds_args, opt->name, argument);
324322
while (*argument)
325323
*argument++= 'x'; /* Destroy argument */
326324
tty_password= 0;
@@ -378,7 +376,7 @@ get_one_option(int optid, const struct my_option *opt,
378376
case OPT_MYSQL_PROTOCOL: /* --protocol */
379377
case OPT_PLUGIN_DIR: /* --plugin-dir */
380378
case OPT_DEFAULT_AUTH: /* --default-auth */
381-
add_one_option_cmd_line(&conn_args, opt, argument);
379+
add_one_option_cmd_line(&conn_args, opt->name, argument);
382380
break;
383381
}
384382

@@ -389,7 +387,7 @@ get_one_option(int optid, const struct my_option *opt,
389387
it can be passed on to "mysql" and "mysqlcheck"
390388
Save it in the ds_args string
391389
*/
392-
add_one_option_cnf_file(&ds_args, opt, argument);
390+
add_one_option_cnf_file(&ds_args, opt->name, argument);
393391
}
394392
return 0;
395393
}
@@ -1349,12 +1347,10 @@ int main(int argc, char **argv)
13491347
{
13501348
opt_password= get_tty_password(NullS);
13511349
/* add password to defaults file */
1352-
add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password);
1353-
DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
1350+
add_one_option_cnf_file(&ds_args, "password", opt_password);
13541351
}
13551352
/* add user to defaults file */
1356-
add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user);
1357-
DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
1353+
add_one_option_cnf_file(&ds_args, "user", opt_user);
13581354

13591355
cnf_file_path= strmov(defaults_file, "--defaults-file=");
13601356
{

mysql-test/main/cte_nonrecursive.result

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,6 +2185,39 @@ select * from t1;
21852185
a
21862186
7
21872187
drop table t1,t2;
2188+
#
2189+
# MDEV-25766: Unused CTE lead to a crash in
2190+
# find_field_in_tables/find_order_in_list
2191+
#
2192+
create table t1 (f1 INTEGER);
2193+
create view v1 as
2194+
select
2195+
subq_0.c4 as c2,
2196+
subq_0.c4 as c4
2197+
from
2198+
(select
2199+
ref_0.f1 as c4
2200+
from
2201+
t1 as ref_0
2202+
where (select 1)
2203+
) as subq_0
2204+
order by c2, c4 desc;
2205+
WITH
2206+
unused_with AS (select
2207+
subq_0.c4 as c6
2208+
from
2209+
(select
2210+
11 as c4
2211+
from
2212+
v1 as ref_0
2213+
) as subq_0,
2214+
v1 as ref_2
2215+
)
2216+
select 1 ;
2217+
1
2218+
1
2219+
drop view v1;
2220+
drop table t1;
21882221
# End of 10.2 tests
21892222
#
21902223
# MDEV-21673: several references to CTE that uses

mysql-test/main/cte_nonrecursive.test

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,42 @@ select * from t1;
16251625

16261626
drop table t1,t2;
16271627

1628+
--echo #
1629+
--echo # MDEV-25766: Unused CTE lead to a crash in
1630+
--echo # find_field_in_tables/find_order_in_list
1631+
--echo #
1632+
1633+
create table t1 (f1 INTEGER);
1634+
1635+
create view v1 as
1636+
select
1637+
subq_0.c4 as c2,
1638+
subq_0.c4 as c4
1639+
from
1640+
(select
1641+
ref_0.f1 as c4
1642+
from
1643+
t1 as ref_0
1644+
where (select 1)
1645+
) as subq_0
1646+
order by c2, c4 desc;
1647+
1648+
WITH
1649+
unused_with AS (select
1650+
subq_0.c4 as c6
1651+
from
1652+
(select
1653+
11 as c4
1654+
from
1655+
v1 as ref_0
1656+
) as subq_0,
1657+
v1 as ref_2
1658+
)
1659+
select 1 ;
1660+
1661+
drop view v1;
1662+
drop table t1;
1663+
16281664
--echo # End of 10.2 tests
16291665

16301666
--echo #

mysql-test/main/subselect4.result

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,6 +1358,8 @@ INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0);
13581358
CREATE TABLE t3 (f4 int,KEY (f4)) ;
13591359
INSERT IGNORE INTO t3 VALUES (0),(0);
13601360
set @@optimizer_switch='semijoin=off';
1361+
# NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY'
1362+
# for line with id=2, see MDEV-27794.
13611363
EXPLAIN
13621364
SELECT * FROM t1 WHERE
13631365
(SELECT f2 FROM t2
@@ -1367,7 +1369,7 @@ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
13671369
GROUP BY SQ1_t1.f4));
13681370
id select_type table type possible_keys key key_len ref rows Extra
13691371
1 PRIMARY t1 system NULL NULL NULL NULL 1
1370-
2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
1372+
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where
13711373
3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using temporary
13721374
3 SUBQUERY SQ1_t3 index f4 f4 5 NULL 2 Using where; Using index; Using join buffer (flat, BNL join)
13731375
SELECT * FROM t1 WHERE

mysql-test/main/subselect4.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,8 @@ INSERT IGNORE INTO t3 VALUES (0),(0);
10391039

10401040
set @@optimizer_switch='semijoin=off';
10411041

1042+
--echo # NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY'
1043+
--echo # for line with id=2, see MDEV-27794.
10421044
EXPLAIN
10431045
SELECT * FROM t1 WHERE
10441046
(SELECT f2 FROM t2

0 commit comments

Comments
 (0)