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
b61b8bf2
Commit
b61b8bf2
authored
Feb 04, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct assignment of default limit (BUG#2600)
parent
147afc0f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
6 deletions
+36
-6
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+11
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+11
-0
sql/sql_lex.cc
sql/sql_lex.cc
+3
-2
sql/sql_parse.cc
sql/sql_parse.cc
+6
-2
sql/sql_yacc.yy
sql/sql_yacc.yy
+5
-2
No files found.
mysql-test/r/subselect.result
View file @
b61b8bf2
...
...
@@ -1625,3 +1625,14 @@ PIPPO
1
NULL
DROP TABLE t1, t2;
create table t1 (a int);
insert into t1 values (1), (2), (3);
SET SQL_SELECT_LIMIT=1;
select sum(a) from (select * from t1) as a;
sum(a)
6
select 2 in (select * from t1);
2 in (select * from t1)
1
SET SQL_SELECT_LIMIT=default;
drop table t1;
mysql-test/t/subselect.test
View file @
b61b8bf2
...
...
@@ -1075,3 +1075,14 @@ s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
t2
AS
cns
;
DROP
TABLE
t1
,
t2
;
#
# GLOBAL LIMIT
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),
(
2
),
(
3
);
SET
SQL_SELECT_LIMIT
=
1
;
select
sum
(
a
)
from
(
select
*
from
t1
)
as
a
;
select
2
in
(
select
*
from
t1
);
SET
SQL_SELECT_LIMIT
=
default
;
drop
table
t1
;
sql/sql_lex.cc
View file @
b61b8bf2
...
...
@@ -1540,8 +1540,9 @@ void st_select_lex::print_limit(THD *thd, String *str)
if
(
!
thd
)
thd
=
current_thd
;
if
(
select_limit
!=
thd
->
variables
.
select_limit
||
select_limit
!=
HA_POS_ERROR
||
if
((
select_limit
!=
thd
->
variables
.
select_limit
&&
this
==
&
thd
->
lex
->
select_lex
)
||
(
select_limit
!=
HA_POS_ERROR
&&
this
!=
&
thd
->
lex
->
select_lex
)
||
offset_limit
!=
0L
)
{
str
->
append
(
" limit "
,
7
);
...
...
sql/sql_parse.cc
View file @
b61b8bf2
...
...
@@ -3758,7 +3758,9 @@ mysql_init_select(LEX *lex)
{
SELECT_LEX
*
select_lex
=
lex
->
current_select
;
select_lex
->
init_select
();
select_lex
->
select_limit
=
lex
->
thd
->
variables
.
select_limit
;
select_lex
->
select_limit
=
(
&
lex
->
select_lex
==
select_lex
)
?
lex
->
thd
->
variables
.
select_limit
:
/* Primry UNION */
HA_POS_ERROR
;
/* subquery */
if
(
select_lex
==
&
lex
->
select_lex
)
{
lex
->
exchange
=
0
;
...
...
@@ -3810,7 +3812,9 @@ mysql_new_select(LEX *lex, bool move_down)
fake
->
select_number
=
INT_MAX
;
fake
->
make_empty_select
();
fake
->
linkage
=
GLOBAL_OPTIONS_TYPE
;
fake
->
select_limit
=
lex
->
thd
->
variables
.
select_limit
;
fake
->
select_limit
=
(
&
lex
->
unit
==
unit
)
?
lex
->
thd
->
variables
.
select_limit
:
/* Primry UNION */
HA_POS_ERROR
;
/* subquery */
}
}
...
...
sql/sql_yacc.yy
View file @
b61b8bf2
...
...
@@ -3476,9 +3476,12 @@ order_dir:
opt_limit_clause_init:
/* empty */
{
SELECT_LEX *sel= Select;
LEX *lex= Lex;
SELECT_LEX *sel= lex->current_select;
sel->offset_limit= 0L;
sel->select_limit= Lex->thd->variables.select_limit;
sel->select_limit= (&lex->select_lex == sel) ?
Lex->thd->variables.select_limit : /* primary SELECT */
HA_POS_ERROR; /* subquery */
}
| limit_clause {}
;
...
...
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