Commit 6405ed63 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge mariadb-10.5.15 into 10.5

parents 1557204b 9aa3564e
...@@ -122,7 +122,6 @@ static struct my_option my_long_options[]= ...@@ -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}, &opt_not_used, &opt_not_used, 0 , GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", 0, {"host", 'h', "Connect to host.", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#define PASSWORD_OPT 12
{"password", 'p', {"password", 'p',
"Password to use when connecting to server. If password is not given," "Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password, " it's solicited on the tty.", &opt_password,&opt_password,
...@@ -154,7 +153,6 @@ static struct my_option my_long_options[]= ...@@ -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.", {"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, &opt_systables_only, &opt_systables_only, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 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, {"user", 'u', "User for login.", &opt_user,
&opt_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &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.", {"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.",
...@@ -262,11 +260,11 @@ static void print_error(const char *error_msg, DYNAMIC_STRING *output) ...@@ -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, static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
const struct my_option *opt, const char *name,
const char* arg) const char *arg)
{ {
dynstr_append(ds, "--"); dynstr_append(ds, "--");
dynstr_append(ds, opt->name); dynstr_append(ds, name);
if (arg) if (arg)
{ {
dynstr_append(ds, "="); dynstr_append(ds, "=");
...@@ -276,10 +274,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds, ...@@ -276,10 +274,10 @@ static void add_one_option_cmd_line(DYNAMIC_STRING *ds,
} }
static void add_one_option_cnf_file(DYNAMIC_STRING *ds, static void add_one_option_cnf_file(DYNAMIC_STRING *ds,
const struct my_option *opt, const char *name,
const char* arg) const char *arg)
{ {
dynstr_append(ds, opt->name); dynstr_append(ds, name);
if (arg) if (arg)
{ {
dynstr_append(ds, "="); dynstr_append(ds, "=");
...@@ -327,7 +325,7 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -327,7 +325,7 @@ get_one_option(const struct my_option *opt, const char *argument,
*/ */
char *start= (char*) argument; char *start= (char*) argument;
/* Add password to ds_args before overwriting the arg with x's */ /* 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) while (*argument)
*(char*)argument++= 'x'; /* Destroy argument */ *(char*)argument++= 'x'; /* Destroy argument */
if (*start) if (*start)
...@@ -387,7 +385,7 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -387,7 +385,7 @@ get_one_option(const struct my_option *opt, const char *argument,
case OPT_MYSQL_PROTOCOL: /* --protocol */ case OPT_MYSQL_PROTOCOL: /* --protocol */
case OPT_PLUGIN_DIR: /* --plugin-dir */ case OPT_PLUGIN_DIR: /* --plugin-dir */
case OPT_DEFAULT_AUTH: /* --default-auth */ 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; break;
} }
...@@ -398,7 +396,7 @@ get_one_option(const struct my_option *opt, const char *argument, ...@@ -398,7 +396,7 @@ get_one_option(const struct my_option *opt, const char *argument,
it can be passed on to "mysql" and "mysqlcheck" it can be passed on to "mysql" and "mysqlcheck"
Save it in the ds_args string 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; return 0;
} }
...@@ -1435,12 +1433,10 @@ int main(int argc, char **argv) ...@@ -1435,12 +1433,10 @@ int main(int argc, char **argv)
{ {
opt_password= get_tty_password(NullS); opt_password= get_tty_password(NullS);
/* add password to defaults file */ /* add password to defaults file */
add_one_option_cnf_file(&ds_args, &my_long_options[PASSWORD_OPT], opt_password); add_one_option_cnf_file(&ds_args, "password", opt_password);
DBUG_ASSERT(strcmp(my_long_options[PASSWORD_OPT].name, "password") == 0);
} }
/* add user to defaults file */ /* add user to defaults file */
add_one_option_cnf_file(&ds_args, &my_long_options[USER_OPT], opt_user); add_one_option_cnf_file(&ds_args, "user", opt_user);
DBUG_ASSERT(strcmp(my_long_options[USER_OPT].name, "user") == 0);
cnf_file_path= strmov(defaults_file, "--defaults-file="); cnf_file_path= strmov(defaults_file, "--defaults-file=");
{ {
......
...@@ -2185,6 +2185,39 @@ select * from t1; ...@@ -2185,6 +2185,39 @@ select * from t1;
a a
7 7
drop table t1,t2; 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 # End of 10.2 tests
# #
# MDEV-21673: several references to CTE that uses # MDEV-21673: several references to CTE that uses
......
...@@ -1637,6 +1637,42 @@ select * from t1; ...@@ -1637,6 +1637,42 @@ select * from t1;
drop table t1,t2; 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 # End of 10.2 tests
--echo # --echo #
......
...@@ -1358,6 +1358,8 @@ INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0); ...@@ -1358,6 +1358,8 @@ INSERT IGNORE INTO t2 VALUES (8,0,0),(5,0,0);
CREATE TABLE t3 (f4 int,KEY (f4)) ; CREATE TABLE t3 (f4 int,KEY (f4)) ;
INSERT IGNORE INTO t3 VALUES (0),(0); INSERT IGNORE INTO t3 VALUES (0),(0);
set @@optimizer_switch='semijoin=off'; set @@optimizer_switch='semijoin=off';
# NOTE: the following should have 'SUBQUERY', not 'DEPENDENT SUBQUERY'
# for line with id=2, see MDEV-27794.
EXPLAIN EXPLAIN
SELECT * FROM t1 WHERE SELECT * FROM t1 WHERE
(SELECT f2 FROM t2 (SELECT f2 FROM t2
...@@ -1367,7 +1369,7 @@ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4 ...@@ -1367,7 +1369,7 @@ FROM t3 AS SQ1_t1 JOIN t3 AS SQ1_t3 ON SQ1_t3.f4
GROUP BY SQ1_t1.f4)); GROUP BY SQ1_t1.f4));
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system NULL NULL NULL NULL 1 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_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) 3 SUBQUERY SQ1_t1 index NULL f4 5 NULL 2 Using index; Using join buffer (flat, BNL join)
SELECT * FROM t1 WHERE SELECT * FROM t1 WHERE
......
...@@ -1039,6 +1039,8 @@ INSERT IGNORE INTO t3 VALUES (0),(0); ...@@ -1039,6 +1039,8 @@ INSERT IGNORE INTO t3 VALUES (0),(0);
set @@optimizer_switch='semijoin=off'; 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 EXPLAIN
SELECT * FROM t1 WHERE SELECT * FROM t1 WHERE
(SELECT f2 FROM t2 (SELECT f2 FROM t2
......
This diff is collapsed.
This diff is collapsed.
#
# MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294
#
CREATE TABLE t1 (i1 int)engine=innodb;
INSERT INTO `t1` VALUES (62),(66);
CREATE TABLE t2 (i1 int) engine=innodb;
SELECT 1 FROM t1
WHERE t1.i1 =( SELECT t1.i1 FROM t2
UNION SELECT i1 FROM (t1 AS dt1 natural JOIN t2)
window w1 as (partition by t1.i1));
1
drop table t1,t2;
# Another testcase
CREATE TABLE t1 (i3 int NOT NULL, i1 int , i2 int , i4 int , PRIMARY key(i2));
INSERT INTO t1 VALUES (6,72,98,98),(46,1,6952,0);
SELECT i1 FROM t1
WHERE t1.i3 =
(SELECT ref_4.i2 FROM t1 AS ref_4
WHERE t1.i2 > (SELECT i3 FROM t1 ORDER BY i3 LIMIT 1 OFFSET 4)
UNION
SELECT ref_6.i2
FROM (t1 AS ref_5 JOIN t1 AS ref_6 ON ((ref_6.i1 > ref_6.i2) OR (ref_5.i4 < ref_5.i4)))
WHERE (t1.i2 >= t1.i2));
i1
drop table t1;
#
# MDEV-25761: Assertion `aggr != __null' failed in sub_select_postjoin_aggr
#
CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (0),(4),(31);
CREATE TABLE t2 (i int) engine=innodb;
DELETE FROM t1 WHERE t1.a =
(SELECT t1.a FROM t2 UNION SELECT DISTINCT 52 FROM t2 r WHERE t1.a = t1.a);
DROP TABLE t1,t2;
--source include/have_innodb.inc
--echo #
--echo # MDEV-25636: Bug report: abortion in sql/sql_parse.cc:6294
--echo #
CREATE TABLE t1 (i1 int)engine=innodb;
INSERT INTO `t1` VALUES (62),(66);
CREATE TABLE t2 (i1 int) engine=innodb;
SELECT 1 FROM t1
WHERE t1.i1 =( SELECT t1.i1 FROM t2
UNION SELECT i1 FROM (t1 AS dt1 natural JOIN t2)
window w1 as (partition by t1.i1));
drop table t1,t2;
--echo # Another testcase
CREATE TABLE t1 (i3 int NOT NULL, i1 int , i2 int , i4 int , PRIMARY key(i2));
INSERT INTO t1 VALUES (6,72,98,98),(46,1,6952,0);
SELECT i1 FROM t1
WHERE t1.i3 =
(SELECT ref_4.i2 FROM t1 AS ref_4
WHERE t1.i2 > (SELECT i3 FROM t1 ORDER BY i3 LIMIT 1 OFFSET 4)
UNION
SELECT ref_6.i2
FROM (t1 AS ref_5 JOIN t1 AS ref_6 ON ((ref_6.i1 > ref_6.i2) OR (ref_5.i4 < ref_5.i4)))
WHERE (t1.i2 >= t1.i2));
drop table t1;
--echo #
--echo # MDEV-25761: Assertion `aggr != __null' failed in sub_select_postjoin_aggr
--echo #
CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY) engine=innodb;
INSERT INTO t1 VALUES (0),(4),(31);
CREATE TABLE t2 (i int) engine=innodb;
DELETE FROM t1 WHERE t1.a =
(SELECT t1.a FROM t2 UNION SELECT DISTINCT 52 FROM t2 r WHERE t1.a = t1.a);
DROP TABLE t1,t2;
...@@ -4199,6 +4199,38 @@ drop procedure sp7; ...@@ -4199,6 +4199,38 @@ drop procedure sp7;
drop view v1,v2; drop view v1,v2;
drop table t1; drop table t1;
# #
# MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode
#
CREATE TABLE t1(a VARCHAR(10), b int);
INSERT INTO t1 VALUES
('Maths', 60),('Maths', 60),
('Maths', 70),('Maths', 55),
('Biology', 60), ('Biology', 70);
SET @save_sql_mode= @@sql_mode;
SET sql_mode = 'ONLY_FULL_GROUP_BY';
SELECT
RANK() OVER (PARTITION BY a ORDER BY b) AS rank,
a, b FROM t1 ORDER BY a, b DESC;
rank a b
2 Biology 70
1 Biology 60
4 Maths 70
2 Maths 60
2 Maths 60
1 Maths 55
SET sql_mode= @save_sql_mode;
DROP TABLE t1;
CREATE TABLE t1(i int,j int);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i;
i LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j)
1 6
2 4
3 2
4 2
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #
......
...@@ -2702,6 +2702,33 @@ drop procedure sp7; ...@@ -2702,6 +2702,33 @@ drop procedure sp7;
drop view v1,v2; drop view v1,v2;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode
--echo #
CREATE TABLE t1(a VARCHAR(10), b int);
INSERT INTO t1 VALUES
('Maths', 60),('Maths', 60),
('Maths', 70),('Maths', 55),
('Biology', 60), ('Biology', 70);
SET @save_sql_mode= @@sql_mode;
SET sql_mode = 'ONLY_FULL_GROUP_BY';
SELECT
RANK() OVER (PARTITION BY a ORDER BY b) AS rank,
a, b FROM t1 ORDER BY a, b DESC;
SET sql_mode= @save_sql_mode;
DROP TABLE t1;
CREATE TABLE t1(i int,j int);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
......
...@@ -1765,7 +1765,7 @@ sub collect_mysqld_features_from_running_server () ...@@ -1765,7 +1765,7 @@ sub collect_mysqld_features_from_running_server ()
} }
mtr_add_arg($args, "--silent"); # Tab separated output mtr_add_arg($args, "--silent"); # Tab separated output
mtr_add_arg($args, "-e '%s'", "use mysql; SHOW VARIABLES"); mtr_add_arg($args, "-e \"use mysql; SHOW VARIABLES\"");
my $cmd= "$mysql " . join(' ', @$args); my $cmd= "$mysql " . join(' ', @$args);
mtr_verbose("cmd: $cmd"); mtr_verbose("cmd: $cmd");
......
...@@ -4205,6 +4205,38 @@ drop procedure sp7; ...@@ -4205,6 +4205,38 @@ drop procedure sp7;
drop view v1,v2; drop view v1,v2;
drop table t1; drop table t1;
# #
# MDEV-17785: Window functions not working in ONLY_FULL_GROUP_BY mode
#
CREATE TABLE t1(a VARCHAR(10), b int);
INSERT INTO t1 VALUES
('Maths', 60),('Maths', 60),
('Maths', 70),('Maths', 55),
('Biology', 60), ('Biology', 70);
SET @save_sql_mode= @@sql_mode;
SET sql_mode = 'ONLY_FULL_GROUP_BY';
SELECT
RANK() OVER (PARTITION BY a ORDER BY b) AS rank,
a, b FROM t1 ORDER BY a, b DESC;
rank a b
2 Biology 70
1 Biology 60
4 Maths 70
2 Maths 60
2 Maths 60
1 Maths 55
SET sql_mode= @save_sql_mode;
DROP TABLE t1;
CREATE TABLE t1(i int,j int);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
INSERT INTO t1 VALUES (1,1), (1,5),(1,4), (2,2),(2,5), (3,3),(4,4);
SELECT i, LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j) FROM t1 GROUP BY i;
i LAST_VALUE(COUNT(i)) OVER (PARTITION BY i ORDER BY j)
1 6
2 4
3 2
4 2
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
# showed # showed
# #
# MDEV-27721 rpl.rpl_relay_max_extension test is not FreeBSD-compatible
--source include/linux.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_row.inc --source include/have_binlog_format_row.inc
--let $rpl_topology=1->2 --let $rpl_topology=1->2
......
#!/bin/bash -ue #!/usr/bin/env bash
set -ue
# Copyright (C) 2017-2021 MariaDB # Copyright (C) 2017-2021 MariaDB
# Copyright (C) 2013 Percona Inc # Copyright (C) 2013 Percona Inc
# #
......
#!/bin/bash -ue #!/usr/bin/env bash
set -ue
# Copyright (C) 2009-2015 Codership Oy # Copyright (C) 2009-2015 Codership Oy
# Copyright (C) 2017-2021 MariaDB # Copyright (C) 2017-2021 MariaDB
# #
......
#!/bin/bash -ue #!/usr/bin/env bash
set -ue
# Copyright (C) 2017-2021 MariaDB # Copyright (C) 2017-2021 MariaDB
# Copyright (C) 2010-2014 Codership Oy # Copyright (C) 2010-2014 Codership Oy
...@@ -740,7 +742,7 @@ EOF ...@@ -740,7 +742,7 @@ EOF
elif [ "$OS" = 'Linux' ]; then elif [ "$OS" = 'Linux' ]; then
tmpfile=$(mktemp "--tmpdir=$tmpdir") tmpfile=$(mktemp "--tmpdir=$tmpdir")
else else
tmpfile=$(TMPDIR="$tmpdir"; mktemp '-d') tmpfile=$(TMPDIR="$tmpdir"; mktemp)
fi fi
wsrep_log_info "Extracting binlog files:" wsrep_log_info "Extracting binlog files:"
......
...@@ -109,6 +109,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref) ...@@ -109,6 +109,8 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
return true; return true;
} }
window_func()->mark_as_window_func_sum_expr();
/* /*
TODO: why the last parameter is 'ref' in this call? What if window_func TODO: why the last parameter is 'ref' in this call? What if window_func
decides to substitute itself for something else and does *ref=.... ? decides to substitute itself for something else and does *ref=.... ?
......
...@@ -355,7 +355,7 @@ void end_read_record(READ_RECORD *info) ...@@ -355,7 +355,7 @@ void end_read_record(READ_RECORD *info)
free_cache(info); free_cache(info);
if (info->table) if (info->table)
{ {
if (info->table->is_created()) if (info->table->db_stat) // if opened
(void) info->table->file->extra(HA_EXTRA_NO_CACHE); (void) info->table->file->extra(HA_EXTRA_NO_CACHE);
if (info->read_record_func != rr_quick) // otherwise quick_range does it if (info->read_record_func != rr_quick) // otherwise quick_range does it
(void) info->table->file->ha_index_or_rnd_end(); (void) info->table->file->ha_index_or_rnd_end();
......
...@@ -6396,8 +6396,11 @@ find_field_in_tables(THD *thd, Item_ident *item, ...@@ -6396,8 +6396,11 @@ find_field_in_tables(THD *thd, Item_ident *item,
for (SELECT_LEX *sl= current_sel; sl && sl!=last_select; for (SELECT_LEX *sl= current_sel; sl && sl!=last_select;
sl=sl->outer_select()) sl=sl->outer_select())
{ {
Item_in_subselect *in_subs= Item *subs= sl->master_unit()->item;
sl->master_unit()->item->get_IN_subquery(); if (!subs)
continue;
Item_in_subselect *in_subs= subs->get_IN_subquery();
if (in_subs && if (in_subs &&
in_subs->substype() == Item_subselect::IN_SUBS && in_subs->substype() == Item_subselect::IN_SUBS &&
in_subs->test_strategy(SUBS_SEMI_JOIN)) in_subs->test_strategy(SUBS_SEMI_JOIN))
......
...@@ -4900,7 +4900,21 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) ...@@ -4900,7 +4900,21 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
} }
if (empty_union_result) if (empty_union_result)
subquery_predicate->no_rows_in_result(); subquery_predicate->no_rows_in_result();
if (!is_correlated_unit)
if (is_correlated_unit)
{
/*
Some parts of UNION are not correlated. This means we will need to
re-execute the whole UNION every time. Mark all parts of the UNION
as correlated so that they are prepared to be executed multiple
times (if we don't do that, some part of the UNION may free its
execution data at the end of first execution and crash on the second
execution)
*/
for (SELECT_LEX *sl= un->first_select(); sl; sl= sl->next_select())
sl->uncacheable |= UNCACHEABLE_DEPENDENT;
}
else
un->uncacheable&= ~UNCACHEABLE_DEPENDENT; un->uncacheable&= ~UNCACHEABLE_DEPENDENT;
subquery_predicate->is_correlated= is_correlated_unit; subquery_predicate->is_correlated= is_correlated_unit;
} }
......
...@@ -10984,9 +10984,6 @@ window_func: ...@@ -10984,9 +10984,6 @@ window_func:
simple_window_func simple_window_func
| |
sum_expr sum_expr
{
((Item_sum *) $1)->mark_as_window_func_sum_expr();
}
| |
function_call_generic function_call_generic
{ {
...@@ -10999,8 +10996,6 @@ window_func: ...@@ -10999,8 +10996,6 @@ window_func:
thd->parse_error(); thd->parse_error();
MYSQL_YYABORT; MYSQL_YYABORT;
} }
((Item_sum *) $1)->mark_as_window_func_sum_expr();
} }
; ;
......
...@@ -721,9 +721,10 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -721,9 +721,10 @@ int maria_create(const char *name, enum data_file_type datafile_type,
share.base.extra_options|= MA_EXTRA_OPTIONS_INSERT_ORDER; share.base.extra_options|= MA_EXTRA_OPTIONS_INSERT_ORDER;
} }
share.state.state.key_file_length= MY_ALIGN(info_length, maria_block_size);
DBUG_PRINT("info", ("info_length: %u", info_length)); DBUG_PRINT("info", ("info_length: %u", info_length));
/* There are only 16 bits for the total header length. */ /* There are only 16 bits for the total header length. */
if (info_length > 65535) if (share.state.state.key_file_length > 65535)
{ {
my_printf_error(HA_WRONG_CREATE_OPTION, my_printf_error(HA_WRONG_CREATE_OPTION,
"Aria table '%s' has too many columns and/or " "Aria table '%s' has too many columns and/or "
...@@ -780,8 +781,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -780,8 +781,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
maria_set_all_keys_active(share.state.key_map, keys); maria_set_all_keys_active(share.state.key_map, keys);
share.base.keystart = share.state.state.key_file_length= share.base.keystart = share.state.state.key_file_length;
MY_ALIGN(info_length, maria_block_size);
share.base.max_key_block_length= maria_block_size; share.base.max_key_block_length= maria_block_size;
share.base.max_key_length=ALIGN_SIZE(max_key_length+4); share.base.max_key_length=ALIGN_SIZE(max_key_length+4);
share.base.records=ci->max_rows; share.base.records=ci->max_rows;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment