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
facd57e5
Commit
facd57e5
authored
Mar 20, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug27257
parents
354c364a
19da4d39
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+25
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+21
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
facd57e5
...
@@ -3880,3 +3880,28 @@ this is a test. 3
...
@@ -3880,3 +3880,28 @@ this is a test. 3
this is a test. 1
this is a test. 1
this is a test. 2
this is a test. 2
DROP table t1;
DROP table t1;
CREATE TABLE t1 (a int, b int);
CREATE TABLE t2 (m int, n int);
INSERT INTO t1 VALUES (2,2), (2,2), (3,3), (3,3), (3,3), (4,4);
INSERT INTO t2 VALUES (1,11), (2,22), (3,32), (4,44), (4,44);
SELECT COUNT(*), a,
(SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
FROM t1 GROUP BY a;
COUNT(*) a (SELECT m FROM t2 WHERE m = count(*) LIMIT 1)
2 2 2
3 3 3
1 4 1
SELECT COUNT(*), a,
(SELECT MIN(m) FROM t2 WHERE m = count(*))
FROM t1 GROUP BY a;
COUNT(*) a (SELECT MIN(m) FROM t2 WHERE m = count(*))
2 2 2
3 3 3
1 4 1
SELECT COUNT(*), a
FROM t1 GROUP BY a
HAVING (SELECT MIN(m) FROM t2 WHERE m = count(*)) > 1;
COUNT(*) a
2 2
3 3
DROP TABLE t1,t2;
mysql-test/t/subselect.test
View file @
facd57e5
...
@@ -2741,4 +2741,25 @@ SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
...
@@ -2741,4 +2741,25 @@ SELECT * FROM (SELECT 'this is ' 'a test.' AS col1, a AS t2 FROM t1) t;
DROP
table
t1
;
DROP
table
t1
;
#
# Bug #27257: COUNT(*) aggregated in outer query
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
CREATE
TABLE
t2
(
m
int
,
n
int
);
INSERT
INTO
t1
VALUES
(
2
,
2
),
(
2
,
2
),
(
3
,
3
),
(
3
,
3
),
(
3
,
3
),
(
4
,
4
);
INSERT
INTO
t2
VALUES
(
1
,
11
),
(
2
,
22
),
(
3
,
32
),
(
4
,
44
),
(
4
,
44
);
SELECT
COUNT
(
*
),
a
,
(
SELECT
m
FROM
t2
WHERE
m
=
count
(
*
)
LIMIT
1
)
FROM
t1
GROUP
BY
a
;
SELECT
COUNT
(
*
),
a
,
(
SELECT
MIN
(
m
)
FROM
t2
WHERE
m
=
count
(
*
))
FROM
t1
GROUP
BY
a
;
SELECT
COUNT
(
*
),
a
FROM
t1
GROUP
BY
a
HAVING
(
SELECT
MIN
(
m
)
FROM
t2
WHERE
m
=
count
(
*
))
>
1
;
DROP
TABLE
t1
,
t2
;
sql/item_sum.cc
View file @
facd57e5
...
@@ -269,6 +269,7 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
...
@@ -269,6 +269,7 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
sl
=
sl
->
master_unit
()
->
outer_select
()
)
sl
=
sl
->
master_unit
()
->
outer_select
()
)
sl
->
master_unit
()
->
item
->
with_sum_func
=
1
;
sl
->
master_unit
()
->
item
->
with_sum_func
=
1
;
}
}
thd
->
lex
->
current_select
->
mark_as_dependent
(
aggr_sl
);
return
FALSE
;
return
FALSE
;
}
}
...
...
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