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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a26847c2
Commit
a26847c2
authored
Sep 13, 2003
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for OPTION_FOUND_ROWS in UNION's
parent
0088e1c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
5 deletions
+8
-5
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+2
-0
mysql-test/r/union.result
mysql-test/r/union.result
+2
-2
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_union.cc
sql/sql_union.cc
+3
-2
No files found.
mysql-test/r/subselect.result
View file @
a26847c2
...
@@ -1046,6 +1046,8 @@ t1 CREATE TABLE `t1` (
...
@@ -1046,6 +1046,8 @@ t1 CREATE TABLE `t1` (
) TYPE=MyISAM CHARSET=latin1
) TYPE=MyISAM CHARSET=latin1
drop table t1;
drop table t1;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
Warnings:
Warning 1262 Data truncated, NULL supplied to NOT NULL column 'a' at row 1
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t1;
Table Create Table
Table Create Table
t1 CREATE TABLE `t1` (
t1 CREATE TABLE `t1` (
...
...
mysql-test/r/union.result
View file @
a26847c2
...
@@ -409,7 +409,7 @@ found_rows()
...
@@ -409,7 +409,7 @@ found_rows()
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 UNION SELECT * FROM t2 LIMIT 2,2;
a
a
3
3
4
5
select found_rows();
select found_rows();
found_rows()
found_rows()
6
6
...
@@ -423,7 +423,7 @@ found_rows()
...
@@ -423,7 +423,7 @@ found_rows()
5
5
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
a
a
5
3
(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
(SELECT * FROM t1 ORDER by a) UNION ALL (SELECT * FROM t2 ORDER BY a) ORDER BY A desc LIMIT 4;
a
a
5
5
...
...
sql/sql_parse.cc
View file @
a26847c2
...
@@ -1729,7 +1729,7 @@ mysql_execute_command(THD *thd)
...
@@ -1729,7 +1729,7 @@ mysql_execute_command(THD *thd)
if
(
unit
->
select_limit_cnt
<
if
(
unit
->
select_limit_cnt
<
(
ha_rows
)
unit
->
global_parameters
->
select_limit
)
(
ha_rows
)
unit
->
global_parameters
->
select_limit
)
unit
->
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
unit
->
select_limit_cnt
=
HA_POS_ERROR
;
// no limit
if
(
unit
->
select_limit_cnt
==
HA_POS_ERROR
)
if
(
unit
->
select_limit_cnt
==
HA_POS_ERROR
&&
!
select_lex
->
next_select
()
)
select_lex
->
options
&=
~
OPTION_FOUND_ROWS
;
select_lex
->
options
&=
~
OPTION_FOUND_ROWS
;
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
)))
if
(
!
(
res
=
open_and_lock_tables
(
thd
,
tables
)))
...
...
sql/sql_union.cc
View file @
a26847c2
...
@@ -281,7 +281,7 @@ int st_select_lex_unit::exec()
...
@@ -281,7 +281,7 @@ int st_select_lex_unit::exec()
*/
*/
sl
->
options
|=
found_rows_for_union
;
sl
->
options
|=
found_rows_for_union
;
}
}
sl
->
join
->
select_options
=
sl
->
options
;
/*
/*
As far as union share table space we should reassign table map,
As far as union share table space we should reassign table map,
which can be spoiled by 'prepare' of JOIN of other UNION parts
which can be spoiled by 'prepare' of JOIN of other UNION parts
...
@@ -311,6 +311,7 @@ int st_select_lex_unit::exec()
...
@@ -311,6 +311,7 @@ int st_select_lex_unit::exec()
records_at_start
=
table
->
file
->
records
;
records_at_start
=
table
->
file
->
records
;
sl
->
join
->
exec
();
sl
->
join
->
exec
();
res
=
sl
->
join
->
error
;
res
=
sl
->
join
->
error
;
offset_limit_cnt
=
sl
->
offset_limit
;
if
(
!
res
&&
union_result
->
flush
())
if
(
!
res
&&
union_result
->
flush
())
{
{
thd
->
lex
.
current_select
=
lex_select_save
;
thd
->
lex
.
current_select
=
lex_select_save
;
...
@@ -332,7 +333,7 @@ int st_select_lex_unit::exec()
...
@@ -332,7 +333,7 @@ int st_select_lex_unit::exec()
We get this from the difference of between total number of possible
We get this from the difference of between total number of possible
rows and actual rows added to the temporary table.
rows and actual rows added to the temporary table.
*/
*/
add_rows
+=
(
ha_rows
)
(
thd
->
limit_found_rows
-
(
ulonglong
)
add_rows
+=
(
ulonglong
)
(
thd
->
limit_found_rows
-
(
ulonglong
)
((
table
->
file
->
records
-
records_at_start
)));
((
table
->
file
->
records
-
records_at_start
)));
}
}
}
}
...
...
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