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
87eea667
Commit
87eea667
authored
Mar 19, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for the limit bug in UNION's and some additional syntax
checkings
parent
2222dd94
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
7 deletions
+38
-7
mysql-test/r/union.result
mysql-test/r/union.result
+21
-0
mysql-test/t/union.test
mysql-test/t/union.test
+8
-0
sql/sql_union.cc
sql/sql_union.cc
+2
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-7
No files found.
mysql-test/r/union.result
View file @
87eea667
...
...
@@ -77,6 +77,8 @@ a b
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
a b
1 a
2 b
3 c
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
a b
3 c
...
...
@@ -157,3 +159,22 @@ testtt
tsestset
1
drop table t1;
drop table if exists t1,t2;
create table t1 (a int);
create table t2 (a int);
insert into t1 values (1),(2),(3),(4),(5);
insert into t2 values (11),(12),(13),(14),(15);
(select * from t1 limit 2) union (select * from t2 limit 3) limit 4;
a
1
2
11
12
(select * from t1 limit 2) union (select * from t2 limit 3);
a
1
2
11
12
13
drop table t1,t2;
mysql-test/t/union.test
View file @
87eea667
...
...
@@ -77,3 +77,11 @@ SELECT pseudo1 FROM t1 WHERE pseudo='joce' UNION SELECT pseudo FROM t1 WHERE pse
SELECT
pseudo1
FROM
t1
WHERE
pseudo
=
'joce'
UNION
ALL
SELECT
pseudo
FROM
t1
WHERE
pseudo1
=
'joce'
;
SELECT
pseudo1
FROM
t1
WHERE
pseudo
=
'joce'
UNION
SELECT
1
;
drop
table
t1
;
drop
table
if
exists
t1
,
t2
;
create
table
t1
(
a
int
);
create
table
t2
(
a
int
);
insert
into
t1
values
(
1
),(
2
),(
3
),(
4
),(
5
);
insert
into
t2
values
(
11
),(
12
),(
13
),(
14
),(
15
);
(
select
*
from
t1
limit
2
)
union
(
select
*
from
t2
limit
3
)
limit
4
;
(
select
*
from
t1
limit
2
)
union
(
select
*
from
t2
limit
3
);
drop
table
t1
,
t2
;
sql/sql_union.cc
View file @
87eea667
...
...
@@ -185,6 +185,8 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
if
(
thd
->
select_limit
==
HA_POS_ERROR
)
thd
->
options
&=
~
OPTION_FOUND_ROWS
;
}
else
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
if
(
describe
)
thd
->
select_limit
=
HA_POS_ERROR
;
// no limit
res
=
mysql_select
(
thd
,
&
result_table_list
,
...
...
sql/sql_yacc.yy
View file @
87eea667
...
...
@@ -1430,22 +1430,22 @@ select_option_list:
select_option:
STRAIGHT_JOIN { Select->options|= SELECT_STRAIGHT_JOIN; }
| HIGH_PRIORITY { Lex->lock_option= TL_READ_HIGH_PRIORITY; }
| HIGH_PRIORITY {
if (Select != &Lex->select_lex) YYABORT;
Lex->lock_option= TL_READ_HIGH_PRIORITY; }
| DISTINCT { Select->options|= SELECT_DISTINCT; }
| SQL_SMALL_RESULT { Select->options|= SELECT_SMALL_RESULT; }
| SQL_BIG_RESULT { Select->options|= SELECT_BIG_RESULT; }
| SQL_BUFFER_RESULT { Select->options|= OPTION_BUFFER_RESULT; }
| SQL_CALC_FOUND_ROWS { Select->options|= OPTION_FOUND_ROWS; }
| SQL_NO_CACHE_SYM { current_thd->safe_to_cache_query=0; }
| SQL_CACHE_SYM { Select->options |= OPTION_TO_QUERY_CACHE; }
| SQL_BUFFER_RESULT {
if (Select != &Lex->select_lex) YYABORT;
Select->options|= OPTION_BUFFER_RESULT; }
| SQL_CALC_FOUND_ROWS {
if (Select != &Lex->select_lex) YYABORT;
Select->options|= OPTION_FOUND_ROWS; }
| SQL_NO_CACHE_SYM {
if (Select != &Lex->select_lex) YYABORT;
current_thd->safe_to_cache_query=0; }
| SQL_CACHE_SYM {
if (Select != &Lex->select_lex) YYABORT;
Select->options |= OPTION_TO_QUERY_CACHE; }
| ALL {}
select_lock_type:
/* empty */
| FOR_SYM UPDATE_SYM
{ Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
{
if (Select != &Lex->select_lex) YYABORT;
Lex->lock_option= TL_WRITE; current_thd->safe_to_cache_query=0; }
| LOCK_SYM IN_SYM SHARE_SYM MODE_SYM
{ Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; }
{
if (Select != &Lex->select_lex) YYABORT;
Lex->lock_option= TL_READ_WITH_SHARED_LOCKS; current_thd->safe_to_cache_query=0; }
select_item_list:
select_item_list ',' select_item
...
...
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