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
333eadf1
Commit
333eadf1
authored
May 03, 2004
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for a bug involving UNION's and SET SQL_SELECT_LIMIT
parent
0a6da89f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
mysql-test/r/union.result
mysql-test/r/union.result
+11
-0
mysql-test/t/union.test
mysql-test/t/union.test
+4
-0
sql/sql_union.cc
sql/sql_union.cc
+12
-3
No files found.
mysql-test/r/union.result
View file @
333eadf1
...
@@ -924,3 +924,14 @@ a
...
@@ -924,3 +924,14 @@ a
1
1
2
2
2
2
set sql_select_limit=1;
select 1 union select 2;
1
1
(select 1) union (select 2);
1
1
(select 1) union (select 2) union (select 3) limit 2;
1
1
2
mysql-test/t/union.test
View file @
333eadf1
...
@@ -498,4 +498,8 @@ select * from t1 UNION ALL select * from t1;
...
@@ -498,4 +498,8 @@ select * from t1 UNION ALL select * from t1;
select
*
from
t1
UNION
select
*
from
t1
UNION
ALL
select
*
from
t1
;
select
*
from
t1
UNION
select
*
from
t1
UNION
ALL
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
select
1
as
a
union
all
select
1
union
all
select
2
union
select
1
union
all
select
2
;
select
1
as
a
union
all
select
1
union
all
select
2
union
select
1
union
all
select
2
;
set
sql_select_limit
=
1
;
select
1
union
select
2
;
(
select
1
)
union
(
select
2
);
(
select
1
)
union
(
select
2
)
union
(
select
3
)
limit
2
;
sql/sql_union.cc
View file @
333eadf1
...
@@ -377,12 +377,21 @@ int st_select_lex_unit::exec()
...
@@ -377,12 +377,21 @@ int st_select_lex_unit::exec()
if
(
!
thd
->
is_fatal_error
)
// Check if EOM
if
(
!
thd
->
is_fatal_error
)
// Check if EOM
{
{
ulong
options_tmp
=
thd
->
options
;
ulong
options_tmp
=
thd
->
options
;
/*
We have to take into the account a case when:
SET SQL_SELECT_LIMIT was set.
In mysql_new_select() function this value was copied to
the fake_select_lex node of the top-level unit.
Here below, we just take this value if global LIMIT was not applied
to the entire UNION.
*/
ha_rows
select_limit
=
((
global_parameters
->
select_limit
!=
HA_POS_ERROR
)
?
global_parameters
->
select_limit
:
fake_select_lex
->
select_limit
);
thd
->
lex
->
current_select
=
fake_select_lex
;
thd
->
lex
->
current_select
=
fake_select_lex
;
offset_limit_cnt
=
global_parameters
->
offset_limit
;
offset_limit_cnt
=
global_parameters
->
offset_limit
;
select_limit_cnt
=
global_parameters
->
select_limit
+
select_limit_cnt
=
select_limit
+
global_parameters
->
offset_limit
;
global_parameters
->
offset_limit
;
if
(
select_limit_cnt
<
global_parameters
->
select_limit
)
if
(
select_limit_cnt
<
select_limit
)
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
if
(
select_limit_cnt
==
HA_POS_ERROR
)
if
(
select_limit_cnt
==
HA_POS_ERROR
)
options_tmp
&=
~
OPTION_FOUND_ROWS
;
options_tmp
&=
~
OPTION_FOUND_ROWS
;
...
...
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