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
3c7b8e4f
Commit
3c7b8e4f
authored
Sep 03, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix (Bug #4980: union statement with () union () order by produces wrong explain).
parent
f956ce52
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
1 deletion
+21
-1
mysql-test/r/union.result
mysql-test/r/union.result
+8
-1
mysql-test/t/union.test
mysql-test/t/union.test
+9
-0
sql/sql_union.cc
sql/sql_union.cc
+4
-0
No files found.
mysql-test/r/union.result
View file @
3c7b8e4f
...
...
@@ -88,7 +88,6 @@ explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a l
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
t2 ALL NULL NULL NULL NULL 4 Using filesort
t1 ALL NULL NULL NULL NULL 4
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
...
...
@@ -424,8 +423,16 @@ create table t1 select a from t1 union select a from t2;
INSERT TABLE 't1' isn't allowed in FROM table list
select a from t1 union select a from t2 order by t2.a;
Unknown column 't2.a' in 'ORDER BY'
drop table t1;
drop table t1,t2;
select length(version()) > 1 as `*` UNION select 2;
*
1
2
create table t1 (a int);
insert into t1 values (0), (3), (1), (2);
explain (select * from t1) union (select * from t1) order by a;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
t1 ALL NULL NULL NULL NULL 4
drop table t1;
mysql-test/t/union.test
View file @
3c7b8e4f
...
...
@@ -228,6 +228,7 @@ create temporary table t1 select a from t1 union select a from t2;
create
table
t1
select
a
from
t1
union
select
a
from
t2
;
--
error
1054
select
a
from
t1
union
select
a
from
t2
order
by
t2
.
a
;
drop
table
t1
;
# Drop temporary table
drop
table
t1
,
t2
;
#
...
...
@@ -236,3 +237,11 @@ drop table t1,t2;
select
length
(
version
())
>
1
as
`*`
UNION
select
2
;
#
# Bug #4980: problem with explain
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
0
),
(
3
),
(
1
),
(
2
);
explain
(
select
*
from
t1
)
union
(
select
*
from
t1
)
order
by
a
;
drop
table
t1
;
sql/sql_union.cc
View file @
3c7b8e4f
...
...
@@ -148,6 +148,10 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
{
ha_rows
records_at_start
;
lex
->
select
=
sl
;
#if MYSQL_VERSION_ID < 40100
if
(
describe
&&
sl
->
linkage
==
NOT_A_SELECT
)
break
;
// Skip extra item in case of 'explain'
#endif
/* Don't use offset for the last union if there is no braces */
if
(
sl
!=
lex_sl
)
{
...
...
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