Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
208a0fab
Commit
208a0fab
authored
Jan 10, 2011
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
1a46e493
d690da66
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
293 additions
and
12 deletions
+293
-12
mysql-test/r/innodb_mysql_sync.result
mysql-test/r/innodb_mysql_sync.result
+24
-0
mysql-test/r/partition_range.result
mysql-test/r/partition_range.result
+4
-4
mysql-test/r/union.result
mysql-test/r/union.result
+125
-0
mysql-test/t/innodb_mysql_sync.test
mysql-test/t/innodb_mysql_sync.test
+41
-0
mysql-test/t/partition_range.test
mysql-test/t/partition_range.test
+2
-2
mysql-test/t/union.test
mysql-test/t/union.test
+67
-0
mysys/my_getopt.c
mysys/my_getopt.c
+19
-1
sql/sql_admin.cc
sql/sql_admin.cc
+2
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+9
-3
No files found.
mysql-test/r/innodb_mysql_sync.result
View file @
208a0fab
...
...
@@ -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';
mysql-test/r/partition_range.result
View file @
208a0fab
...
...
@@ -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;
...
...
mysql-test/r/union.result
View file @
208a0fab
...
...
@@ -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
mysql-test/t/innodb_mysql_sync.test
View file @
208a0fab
...
...
@@ -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
...
...
mysql-test/t/partition_range.test
View file @
208a0fab
...
...
@@ -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
;
...
...
mysql-test/t/union.test
View file @
208a0fab
...
...
@@ -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
;
mysys/my_getopt.c
View file @
208a0fab
...
...
@@ -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
);
...
...
sql/sql_admin.cc
View file @
208a0fab
/* 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 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
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
();
...
...
sql/sql_yacc.yy
View file @
208a0fab
...
...
@@ -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;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment