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
91e93eb7
Commit
91e93eb7
authored
Sep 05, 2006
by
gkodinov/kgeorge@macbook.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge macbook.gmz:/Users/kgeorge/mysql/work/B16792-4.1-opt
into macbook.gmz:/Users/kgeorge/mysql/work/B16792-5.0-opt
parents
d99ac638
9ff33b5d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
12 deletions
+52
-12
mysql-test/r/func_gconcat.result
mysql-test/r/func_gconcat.result
+2
-2
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+16
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+2
-2
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+13
-0
sql/opt_sum.cc
sql/opt_sum.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+17
-6
No files found.
mysql-test/r/func_gconcat.result
View file @
91e93eb7
...
...
@@ -566,14 +566,14 @@ COUNT(*) GROUP_CONCAT(DISTINCT t2.somename SEPARATOR ' |')
DROP TABLE t1,t2;
select * from (select group_concat('c') from DUAL) t;
group_concat('c')
NULL
c
create table t1 ( a int not null default 0);
select * from (select group_concat(a) from t1) t2;
group_concat(a)
NULL
select group_concat('x') UNION ALL select 1;
group_concat('x')
NULL
x
1
drop table t1;
CREATE TABLE t1 (id int, a varchar(9));
...
...
mysql-test/r/func_group.result
View file @
91e93eb7
...
...
@@ -845,6 +845,22 @@ EXPLAIN SELECT MAX(b) FROM t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(2,3);
SELECT (SELECT COUNT(DISTINCT t1.b)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT t1.b))
1
1
SELECT (SELECT COUNT(DISTINCT 12)) FROM t1 GROUP BY t1.a;
(SELECT COUNT(DISTINCT 12))
1
1
SELECT AVG(2), BIT_AND(2), BIT_OR(2), BIT_XOR(2), COUNT(*), COUNT(12),
COUNT(DISTINCT 12), MIN(2),MAX(2),STD(2), VARIANCE(2),SUM(2),
GROUP_CONCAT(2),GROUP_CONCAT(DISTINCT 2);
AVG(2) BIT_AND(2) BIT_OR(2) BIT_XOR(2) COUNT(*) COUNT(12) COUNT(DISTINCT 12) MIN(2) MAX(2) STD(2) VARIANCE(2) SUM(2) GROUP_CONCAT(2) GROUP_CONCAT(DISTINCT 2)
2.0000 2 2 2 1 1 1 2 2 0.0000 0.0000 2 2 2
DROP TABLE t1;
CREATE TABLE t1 (id int , b varchar(512), INDEX(b(250))) COLLATE latin1_bin;
INSERT INTO t1 VALUES
(1,CONCAT(REPEAT('_', 250), "qq")), (1,CONCAT(REPEAT('_', 250), "zz")),
...
...
mysql-test/r/subselect.result
View file @
91e93eb7
...
...
@@ -1011,7 +1011,7 @@ INSERT INTO t1 VALUES (1);
UPDATE t1 SET i=i+1 WHERE i=(SELECT MAX(i));
select * from t1;
i
1
2
drop table t1;
CREATE TABLE t1 (a int(1));
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
...
...
@@ -1203,7 +1203,7 @@ UPDATE t1 SET t.i=i+(SELECT MAX(i) FROM (SELECT 1) t);
ERROR 42S22: Unknown column 't.i' in 'field list'
select * from t1;
i
1
3
drop table t1;
CREATE TABLE t1 (
id int(11) default NULL
...
...
mysql-test/t/func_group.test
View file @
91e93eb7
...
...
@@ -566,6 +566,19 @@ INSERT INTO t1 VALUES
SELECT
MAX
(
b
)
FROM
t1
;
EXPLAIN
SELECT
MAX
(
b
)
FROM
t1
;
DROP
TABLE
t1
;
#
# Bug #16792 query with subselect, join, and group not returning proper values
#
CREATE
TABLE
t1
(
a
INT
,
b
INT
);
INSERT
INTO
t1
VALUES
(
1
,
1
),(
1
,
2
),(
2
,
3
);
SELECT
(
SELECT
COUNT
(
DISTINCT
t1
.
b
))
FROM
t1
GROUP
BY
t1
.
a
;
SELECT
(
SELECT
COUNT
(
DISTINCT
12
))
FROM
t1
GROUP
BY
t1
.
a
;
# an attempt to test all aggregate function with no table.
SELECT
AVG
(
2
),
BIT_AND
(
2
),
BIT_OR
(
2
),
BIT_XOR
(
2
),
COUNT
(
*
),
COUNT
(
12
),
COUNT
(
DISTINCT
12
),
MIN
(
2
),
MAX
(
2
),
STD
(
2
),
VARIANCE
(
2
),
SUM
(
2
),
GROUP_CONCAT
(
2
),
GROUP_CONCAT
(
DISTINCT
2
);
DROP
TABLE
t1
;
# End of 4.1 tests
...
...
sql/opt_sum.cc
View file @
91e93eb7
...
...
@@ -191,7 +191,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Type of range for the key part for this field will be
returned in range_fl.
*/
if
((
outer_tables
&
table
->
map
)
||
if
(
table
->
file
->
inited
||
(
outer_tables
&
table
->
map
)
||
!
find_key_for_maxmin
(
0
,
&
ref
,
item_field
->
field
,
conds
,
&
range_fl
,
&
prefix_len
))
{
...
...
@@ -278,7 +278,7 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
Type of range for the key part for this field will be
returned in range_fl.
*/
if
((
outer_tables
&
table
->
map
)
||
if
(
table
->
file
->
inited
||
(
outer_tables
&
table
->
map
)
||
!
find_key_for_maxmin
(
1
,
&
ref
,
item_field
->
field
,
conds
,
&
range_fl
,
&
prefix_len
))
{
...
...
sql/sql_select.cc
View file @
91e93eb7
...
...
@@ -1324,7 +1324,7 @@ JOIN::exec()
}
(
void
)
result
->
prepare2
();
// Currently, this cannot fail.
if
(
!
tables_list
)
if
(
!
tables_list
&&
(
tables
||
!
select_lex
->
with_sum_func
)
)
{
// Only test of functions
if
(
select_options
&
SELECT_DESCRIBE
)
select_describe
(
this
,
FALSE
,
FALSE
,
FALSE
,
...
...
@@ -1364,7 +1364,12 @@ JOIN::exec()
thd
->
examined_row_count
=
0
;
DBUG_VOID_RETURN
;
}
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
/*
don't reset the found rows count if there're no tables
as FOUND_ROWS() may be called.
*/
if
(
tables
)
thd
->
limit_found_rows
=
thd
->
examined_row_count
=
0
;
if
(
zero_result_cause
)
{
...
...
@@ -1403,7 +1408,8 @@ JOIN::exec()
having
=
tmp_having
;
select_describe
(
this
,
need_tmp
,
order
!=
0
&&
!
skip_sort_order
,
select_distinct
);
select_distinct
,
!
tables
?
"No tables used"
:
NullS
);
DBUG_VOID_RETURN
;
}
...
...
@@ -9728,9 +9734,13 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
table
->
file
->
ha_index_init
(
0
);
}
/* Set up select_end */
join
->
join_tab
[
join
->
tables
-
1
].
next_select
=
setup_end_select_func
(
join
);
Next_select_func
end_select
=
setup_end_select_func
(
join
);
if
(
join
->
tables
)
{
join
->
join_tab
[
join
->
tables
-
1
].
next_select
=
end_select
;
join_tab
=
join
->
join_tab
+
join
->
const_tables
;
join_tab
=
join
->
join_tab
+
join
->
const_tables
;
}
join
->
send_records
=
0
;
if
(
join
->
tables
==
join
->
const_tables
)
{
...
...
@@ -9740,7 +9750,6 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
*/
if
(
!
join
->
conds
||
join
->
conds
->
val_int
())
{
Next_select_func
end_select
=
join
->
join_tab
[
join
->
tables
-
1
].
next_select
;
error
=
(
*
end_select
)(
join
,
join_tab
,
0
);
if
(
error
==
NESTED_LOOP_OK
||
error
==
NESTED_LOOP_QUERY_LIMIT
)
error
=
(
*
end_select
)(
join
,
join_tab
,
1
);
...
...
@@ -9754,6 +9763,8 @@ do_select(JOIN *join,List<Item> *fields,TABLE *table,Procedure *procedure)
}
else
{
DBUG_ASSERT
(
join
->
tables
);
DBUG_ASSERT
(
join_tab
);
error
=
sub_select
(
join
,
join_tab
,
0
);
if
(
error
==
NESTED_LOOP_OK
||
error
==
NESTED_LOOP_NO_MORE_ROWS
)
error
=
sub_select
(
join
,
join_tab
,
1
);
...
...
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