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
34998c5a
Commit
34998c5a
authored
Apr 03, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for SQL_CALC_FOUND_ROWS in UNION's
parent
fd7b04ad
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
1 deletion
+17
-1
Docs/manual.texi
Docs/manual.texi
+4
-0
mysql-test/r/union.result
mysql-test/r/union.result
+7
-0
mysql-test/t/union.test
mysql-test/t/union.test
+2
-1
sql/sql_union.cc
sql/sql_union.cc
+4
-0
No files found.
Docs/manual.texi
View file @
34998c5a
...
@@ -48946,6 +48946,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -48946,6 +48946,10 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
fixed that SQL_CALC_FOUND_ROWS works with UNIONs. It will work only if first
select has this option and if there is global LIMIT for entire select. For the
moment this requires using braces for individual select's.
@item
Don't give an error for @code{CREATE TABLE ...(... VARCHAR(0))}.
Don't give an error for @code{CREATE TABLE ...(... VARCHAR(0))}.
@item
@item
Fixed @code{SIGINT} and @code{SIGQUIT} problems in @file{mysql.cc} on Linux
Fixed @code{SIGINT} and @code{SIGQUIT} problems in @file{mysql.cc} on Linux
mysql-test/r/union.result
View file @
34998c5a
...
@@ -89,6 +89,13 @@ table type possible_keys key key_len ref rows Extra
...
@@ -89,6 +89,13 @@ table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
t1 ALL NULL NULL NULL NULL 4
t2 ALL NULL NULL NULL NULL 4 Using filesort
t2 ALL NULL NULL NULL NULL 4 Using filesort
t1 ALL NULL NULL NULL NULL 4
t1 ALL NULL NULL NULL NULL 4
(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
a b
1 a
2 b
select found_rows();
FOUND_ROWS()
6
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 @
34998c5a
...
@@ -21,7 +21,8 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
...
@@ -21,7 +21,8 @@ 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
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
;
explain
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
(
select
sql_calc_found_rows
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
2
;
select
found_rows
();
# 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 @
34998c5a
...
@@ -33,6 +33,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -33,6 +33,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
TABLE
*
table
;
TABLE
*
table
;
int
describe
=
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
?
1
:
0
;
int
describe
=
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
?
1
:
0
;
int
res
;
int
res
;
bool
fr
=
false
;
TABLE_LIST
result_table_list
;
TABLE_LIST
result_table_list
;
TABLE_LIST
*
first_table
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
TABLE_LIST
*
first_table
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
TMP_TABLE_PARAM
tmp_table_param
;
TMP_TABLE_PARAM
tmp_table_param
;
...
@@ -60,6 +61,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -60,6 +61,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
*/
*/
lex_sl
=
sl
;
lex_sl
=
sl
;
order
=
(
ORDER
*
)
lex_sl
->
order_list
.
first
;
order
=
(
ORDER
*
)
lex_sl
->
order_list
.
first
;
fr
=
lex
->
select_lex
.
options
&
OPTION_FOUND_ROWS
&&
!
describe
&&
sl
->
select_limit
&&
sl
->
select_limit
!=
HA_POS_ERROR
;
if
(
!
order
||
!
describe
)
if
(
!
order
||
!
describe
)
last_sl
->
next
=
0
;
// Remove this extra element
last_sl
->
next
=
0
;
// Remove this extra element
}
}
...
@@ -198,6 +200,8 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -198,6 +200,8 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
item_list
,
NULL
,
(
describe
)
?
0
:
order
,
item_list
,
NULL
,
(
describe
)
?
0
:
order
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
(
ORDER
*
)
NULL
,
NULL
,
(
ORDER
*
)
NULL
,
thd
->
options
,
result
);
thd
->
options
,
result
);
if
(
fr
&&
!
res
)
thd
->
limit_found_rows
=
(
ulonglong
)
table
->
file
->
records
;
}
}
}
}
...
...
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