merge
This commit is contained in:
commit
0df98f62c3
@ -66,3 +66,27 @@ SELECT ((@id := id) - id) FROM t2;
|
||||
KILL @id;
|
||||
SET DEBUG_SYNC= "now SIGNAL killed";
|
||||
DROP TABLE t1, t2;
|
||||
SET DEBUG_SYNC= "RESET";
|
||||
#
|
||||
# Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
|
||||
# OPTIMIZE TABLE
|
||||
#
|
||||
DROP TABLE IF EXISTS t1;
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
# Connection con1
|
||||
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
|
||||
# Sending:
|
||||
OPTIMIZE TABLE t1;
|
||||
# Connection default
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
|
||||
KILL QUERY ID;
|
||||
SET DEBUG_SYNC= 'now SIGNAL killed';
|
||||
# Connection con1
|
||||
# Reaping: OPTIMIZE TABLE t1
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
|
||||
test.t1 optimize status Operation failed
|
||||
# Connection default
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
|
@ -13,16 +13,16 @@ EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100, 3) GROUP BY a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 5 NULL 4 Using where; Using index
|
||||
DROP TABLE t1;
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
create table t1 (a DATETIME)
|
||||
partition by range (TO_DAYS(a))
|
||||
subpartition by hash(to_seconds(a))
|
||||
(partition p0 values less than (1));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
`a` datetime DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
/*!50500 PARTITION BY RANGE (a)
|
||||
/*!50500 PARTITION BY RANGE (TO_DAYS(a))
|
||||
SUBPARTITION BY HASH (to_seconds(a))
|
||||
(PARTITION p0 VALUES LESS THAN (1) ENGINE = MyISAM) */
|
||||
drop table t1;
|
||||
|
@ -1644,3 +1644,128 @@ b
|
||||
2
|
||||
DROP TABLE t1,t2;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# Bug#57986 ORDER BY clause is not used after a UNION,
|
||||
# if embedded in a SELECT
|
||||
#
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
|
||||
INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1b 1
|
||||
t2a 1
|
||||
t2b 1
|
||||
t1a 2
|
||||
t1b 2
|
||||
t2a 2
|
||||
t2b 2
|
||||
t1a 3
|
||||
t2a 3
|
||||
SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1b 1
|
||||
t2a 1
|
||||
t2b 1
|
||||
t1a 2
|
||||
t1b 2
|
||||
t2a 2
|
||||
t2b 2
|
||||
t1a 3
|
||||
t2a 3
|
||||
SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1a 2
|
||||
t1a 3
|
||||
t1b 2
|
||||
t1b 1
|
||||
t2a 1
|
||||
t2a 2
|
||||
t2a 3
|
||||
t2b 2
|
||||
t2b 1
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
ORDER BY c2, c1
|
||||
) AS res;
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1b 1
|
||||
t2a 1
|
||||
t2b 1
|
||||
t1a 2
|
||||
t1b 2
|
||||
t2a 2
|
||||
t2b 2
|
||||
t1a 3
|
||||
t2a 3
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
ORDER BY c2 DESC, c1 LIMIT 1
|
||||
) AS res;
|
||||
c1 c2
|
||||
t1a 3
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
|
||||
) AS res;
|
||||
c1 c2
|
||||
t1a 1
|
||||
t1a 2
|
||||
t1a 3
|
||||
t1b 2
|
||||
t1b 1
|
||||
t2a 3
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
SELECT c1, c2 FROM t2
|
||||
ORDER BY c2 DESC, c1 DESC LIMIT 1
|
||||
) AS res;
|
||||
c1 c2
|
||||
t2a 3
|
||||
SELECT c1, c2 FROM (
|
||||
(
|
||||
(SELECT c1, c2 FROM t1)
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
)
|
||||
ORDER BY c2 DESC, c1 ASC LIMIT 1
|
||||
) AS res;
|
||||
c1 c2
|
||||
t1a 3
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# Bug #58970 Problem Subquery (without referencing a table)
|
||||
# and Order By
|
||||
#
|
||||
SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev;
|
||||
dev
|
||||
0
|
||||
SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
|
||||
dev
|
||||
1
|
||||
SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev;
|
||||
dev
|
||||
0
|
||||
SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
|
||||
dev
|
||||
1
|
||||
SELECT(SELECT 1 AS a ORDER BY a) AS dev;
|
||||
dev
|
||||
1
|
||||
SELECT(SELECT 1 AS a LIMIT 1) AS dev;
|
||||
dev
|
||||
1
|
||||
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
|
||||
dev
|
||||
1
|
||||
|
@ -104,6 +104,47 @@ SELECT ((@id := id) - id) FROM t2;
|
||||
KILL @id;
|
||||
SET DEBUG_SYNC= "now SIGNAL killed";
|
||||
DROP TABLE t1, t2;
|
||||
disconnect con1;
|
||||
--source include/wait_until_count_sessions.inc
|
||||
SET DEBUG_SYNC= "RESET";
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug#58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
|
||||
--echo # OPTIMIZE TABLE
|
||||
--echo #
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
|
||||
--echo # Connection con1
|
||||
connect (con1,localhost,root);
|
||||
let $ID= `SELECT connection_id()`;
|
||||
SET DEBUG_SYNC= 'ha_admin_open_ltable SIGNAL waiting WAIT_FOR killed';
|
||||
--echo # Sending:
|
||||
--send OPTIMIZE TABLE t1
|
||||
|
||||
--echo # Connection default
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR waiting';
|
||||
--replace_result $ID ID
|
||||
eval KILL QUERY $ID;
|
||||
SET DEBUG_SYNC= 'now SIGNAL killed';
|
||||
|
||||
--echo # Connection con1
|
||||
connection con1;
|
||||
--echo # Reaping: OPTIMIZE TABLE t1
|
||||
--reap
|
||||
|
||||
--echo # Connection default
|
||||
connection default;
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
disconnect con1;
|
||||
|
||||
|
||||
# Check that all connections opened by test cases in this file are really
|
||||
|
@ -30,8 +30,8 @@ DROP TABLE t1;
|
||||
#
|
||||
#BUG#49591, Add proper version number to SHOW CREATE TABLE
|
||||
#
|
||||
create table t1 (a int)
|
||||
partition by range (a)
|
||||
create table t1 (a DATETIME)
|
||||
partition by range (TO_DAYS(a))
|
||||
subpartition by hash(to_seconds(a))
|
||||
(partition p0 values less than (1));
|
||||
show create table t1;
|
||||
|
@ -1117,3 +1117,70 @@ DROP TABLE t1,t2;
|
||||
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#57986 ORDER BY clause is not used after a UNION,
|
||||
--echo # if embedded in a SELECT
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
CREATE TABLE t2 (c1 VARCHAR(10) NOT NULL, c2 INT NOT NULL);
|
||||
|
||||
|
||||
INSERT INTO t1 (c1, c2) VALUES ('t1a', 1), ('t1a', 2), ('t1a', 3), ('t1b', 2), ('t1b', 1);
|
||||
INSERT INTO t2 (c1, c2) VALUES ('t2a', 1), ('t2a', 2), ('t2a', 3), ('t2b', 2), ('t2b', 1);
|
||||
|
||||
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY c2, c1;
|
||||
SELECT * FROM t1 UNION (SELECT * FROM t2) ORDER BY c2, c1;
|
||||
SELECT * FROM t1 UNION (SELECT * FROM t2 ORDER BY c2, c1);
|
||||
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
ORDER BY c2, c1
|
||||
) AS res;
|
||||
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
ORDER BY c2 DESC, c1 LIMIT 1
|
||||
) AS res;
|
||||
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2 ORDER BY c2 DESC, c1 LIMIT 1)
|
||||
) AS res;
|
||||
|
||||
SELECT c1, c2 FROM (
|
||||
SELECT c1, c2 FROM t1
|
||||
UNION
|
||||
SELECT c1, c2 FROM t2
|
||||
ORDER BY c2 DESC, c1 DESC LIMIT 1
|
||||
) AS res;
|
||||
|
||||
SELECT c1, c2 FROM (
|
||||
(
|
||||
(SELECT c1, c2 FROM t1)
|
||||
UNION
|
||||
(SELECT c1, c2 FROM t2)
|
||||
)
|
||||
ORDER BY c2 DESC, c1 ASC LIMIT 1
|
||||
) AS res;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #58970 Problem Subquery (without referencing a table)
|
||||
--echo # and Order By
|
||||
--echo #
|
||||
|
||||
SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a ASC LIMIT 1) AS dev;
|
||||
SELECT(SELECT 0 AS a UNION SELECT 1 AS a ORDER BY a DESC LIMIT 1) AS dev;
|
||||
SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a ASC LIMIT 1) AS dev;
|
||||
SELECT(SELECT 0 AS a FROM dual UNION SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
|
||||
SELECT(SELECT 1 AS a ORDER BY a) AS dev;
|
||||
SELECT(SELECT 1 AS a LIMIT 1) AS dev;
|
||||
SELECT(SELECT 1 AS a FROM dual ORDER BY a DESC LIMIT 1) AS dev;
|
||||
|
@ -602,6 +602,24 @@ static char *check_struct_option(char *cur_arg, char *key_name)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Parse a boolean command line argument
|
||||
|
||||
"ON", "TRUE" and "1" will return true,
|
||||
other values will return false.
|
||||
|
||||
@param[in] argument The value argument
|
||||
@return boolean value
|
||||
*/
|
||||
static my_bool get_bool_argument(const char *argument)
|
||||
{
|
||||
if (!my_strcasecmp(&my_charset_latin1, argument, "true") ||
|
||||
!my_strcasecmp(&my_charset_latin1, argument, "on"))
|
||||
return 1;
|
||||
else
|
||||
return (my_bool) atoi(argument);
|
||||
}
|
||||
|
||||
/*
|
||||
function: setval
|
||||
|
||||
@ -629,7 +647,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
|
||||
|
||||
switch ((opts->var_type & GET_TYPE_MASK)) {
|
||||
case GET_BOOL: /* If argument differs from 0, enable option, else disable */
|
||||
*((my_bool*) value)= (my_bool) atoi(argument) != 0;
|
||||
*((my_bool*) value)= get_bool_argument(argument);
|
||||
break;
|
||||
case GET_INT:
|
||||
*((int*) value)= (int) getopt_ll(argument, opts, &err);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -728,7 +728,7 @@ send_result_message:
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
if (result_code) // either mysql_recreate_table or analyze failed
|
||||
{
|
||||
DBUG_ASSERT(thd->is_error());
|
||||
DBUG_ASSERT(thd->is_error() || thd->killed);
|
||||
if (thd->is_error())
|
||||
{
|
||||
const char *err_msg= thd->stmt_da->message();
|
||||
|
@ -9396,7 +9396,7 @@ table_factor:
|
||||
;
|
||||
|
||||
select_derived_union:
|
||||
select_derived opt_order_clause opt_limit_clause
|
||||
select_derived opt_union_order_or_limit
|
||||
| select_derived_union
|
||||
UNION_SYM
|
||||
union_option
|
||||
@ -9412,7 +9412,7 @@ select_derived_union:
|
||||
*/
|
||||
Lex->pop_context();
|
||||
}
|
||||
opt_order_clause opt_limit_clause
|
||||
opt_union_order_or_limit
|
||||
;
|
||||
|
||||
/* The equivalent of select_init2 for nested queries. */
|
||||
@ -13862,6 +13862,11 @@ union_opt:
|
||||
| union_order_or_limit { $$= 1; }
|
||||
;
|
||||
|
||||
opt_union_order_or_limit:
|
||||
/* Empty */
|
||||
| union_order_or_limit
|
||||
;
|
||||
|
||||
union_order_or_limit:
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
@ -13909,7 +13914,7 @@ query_specification:
|
||||
;
|
||||
|
||||
query_expression_body:
|
||||
query_specification
|
||||
query_specification opt_union_order_or_limit
|
||||
| query_expression_body
|
||||
UNION_SYM union_option
|
||||
{
|
||||
@ -13917,6 +13922,7 @@ query_expression_body:
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
query_specification
|
||||
opt_union_order_or_limit
|
||||
{
|
||||
Lex->pop_context();
|
||||
$$= $1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user