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
4bd34624
Commit
4bd34624
authored
Apr 02, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sinisa@work.mysql.com:/home/bk/mysql-4.0
into sinisa.nasamreza.org:/mnt/hdc/Sinisa/mysql-4.0
parents
6a5c6b17
95ac8252
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
mysql-test/r/union.result
mysql-test/r/union.result
+5
-0
mysql-test/t/union.test
mysql-test/t/union.test
+1
-0
sql/sql_union.cc
sql/sql_union.cc
+5
-3
No files found.
mysql-test/r/union.result
View file @
4bd34624
...
@@ -84,6 +84,11 @@ a b
...
@@ -84,6 +84,11 @@ a b
3 c
3 c
2 b
2 b
1 a
1 a
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
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
explain select a,b from t1 union all select a,b from t2;
explain select a,b from t1 union all select a,b from t2;
table type possible_keys key key_len ref rows Extra
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
t1 ALL NULL NULL NULL NULL 4
...
...
mysql-test/t/union.test
View file @
4bd34624
...
@@ -20,6 +20,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
...
@@ -20,6 +20,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
4
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
4
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
);
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
);
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
explain
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
# Test some error conditions with UNION
# Test some error conditions with UNION
explain
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
explain
select
a
,
b
from
t1
union
all
select
a
,
b
from
t2
;
...
...
sql/sql_union.cc
View file @
4bd34624
...
@@ -34,6 +34,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -34,6 +34,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
int
describe
=
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
?
1
:
0
;
int
describe
=
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
?
1
:
0
;
int
res
;
int
res
;
TABLE_LIST
result_table_list
;
TABLE_LIST
result_table_list
;
TABLE_LIST
*
first_table
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
TMP_TABLE_PARAM
tmp_table_param
;
TMP_TABLE_PARAM
tmp_table_param
;
select_union
*
union_result
;
select_union
*
union_result
;
DBUG_ENTER
(
"mysql_union"
);
DBUG_ENTER
(
"mysql_union"
);
...
@@ -58,8 +59,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -58,8 +59,9 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
the ORDER BY and LIMIT parameter for the whole UNION
the ORDER BY and LIMIT parameter for the whole UNION
*/
*/
lex_sl
=
sl
;
lex_sl
=
sl
;
last_sl
->
next
=
0
;
// Remove this extra element
order
=
(
ORDER
*
)
lex_sl
->
order_list
.
first
;
order
=
(
ORDER
*
)
lex_sl
->
order_list
.
first
;
if
(
!
order
||
!
describe
)
last_sl
->
next
=
0
;
// Remove this extra element
}
}
else
if
(
!
last_sl
->
braces
)
else
if
(
!
last_sl
->
braces
)
{
{
...
@@ -136,7 +138,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -136,7 +138,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if
(
thd
->
select_limit
==
HA_POS_ERROR
)
if
(
thd
->
select_limit
==
HA_POS_ERROR
)
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
sl
->
options
&=
~
OPTION_FOUND_ROWS
;
res
=
mysql_select
(
thd
,
(
TABLE_LIST
*
)
sl
->
table_list
.
first
,
res
=
mysql_select
(
thd
,
(
describe
&&
sl
->
linkage
==
NOT_A_SELECT
)
?
first_table
:
(
TABLE_LIST
*
)
sl
->
table_list
.
first
,
sl
->
item_list
,
sl
->
item_list
,
sl
->
where
,
sl
->
where
,
(
sl
->
braces
)
?
(
ORDER
*
)
sl
->
order_list
.
first
:
(
ORDER
*
)
0
,
(
sl
->
braces
)
?
(
ORDER
*
)
sl
->
order_list
.
first
:
(
ORDER
*
)
0
,
...
@@ -193,7 +195,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -193,7 +195,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if
(
describe
)
if
(
describe
)
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
res
=
mysql_select
(
thd
,
&
result_table_list
,
res
=
mysql_select
(
thd
,
&
result_table_list
,
item_list
,
NULL
,
/*ftfunc_list,*/
order
,
item_list
,
NULL
,
(
describe
)
?
0
:
order
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
thd
->
options
,
result
);
thd
->
options
,
result
);
}
}
...
...
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