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
4716c99a
Commit
4716c99a
authored
Sep 27, 2006
by
holyfoot/hf@mysql.com/deer.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk@192.168.21.1:mysql-4.1-opt
into mysql.com:/home/hf/work/mysql-4.1.15428
parents
14b16d89
55dd569b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
0 deletions
+74
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+36
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+37
-0
sql/item.cc
sql/item.cc
+1
-0
No files found.
mysql-test/r/subselect.result
View file @
4716c99a
...
...
@@ -2946,3 +2946,39 @@ ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
a a b
10 1 359
drop table t1,t2;
CREATE TABLE t1 (
field1 int NOT NULL,
field2 int NOT NULL,
field3 int NOT NULL,
PRIMARY KEY (field1,field2,field3)
);
CREATE TABLE t2 (
fieldA int NOT NULL,
fieldB int NOT NULL,
PRIMARY KEY (fieldA,fieldB)
);
INSERT INTO t1 VALUES
(1,1,1), (1,1,2), (1,2,1), (1,2,2), (1,2,3), (1,3,1);
INSERT INTO t2 VALUES (1,1), (1,2), (1,3);
SELECT field1, field2, COUNT(*)
FROM t1 GROUP BY field1, field2;
field1 field2 COUNT(*)
1 1 2
1 2 3
1 3 1
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) >= ALL (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 2
SELECT field1, field2
FROM t1
GROUP BY field1, field2
HAVING COUNT(*) < ANY (SELECT fieldB
FROM t2 WHERE fieldA = field1);
field1 field2
1 1
1 3
DROP TABLE t1, t2;
mysql-test/t/subselect.test
View file @
4716c99a
...
...
@@ -1911,4 +1911,41 @@ SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
drop
table
t1
,
t2
;
#
# Bug #21853: assert failure for a grouping query with
# an ALL/ANY quantified subquery in HAVING
#
CREATE
TABLE
t1
(
field1
int
NOT
NULL
,
field2
int
NOT
NULL
,
field3
int
NOT
NULL
,
PRIMARY
KEY
(
field1
,
field2
,
field3
)
);
CREATE
TABLE
t2
(
fieldA
int
NOT
NULL
,
fieldB
int
NOT
NULL
,
PRIMARY
KEY
(
fieldA
,
fieldB
)
);
INSERT
INTO
t1
VALUES
(
1
,
1
,
1
),
(
1
,
1
,
2
),
(
1
,
2
,
1
),
(
1
,
2
,
2
),
(
1
,
2
,
3
),
(
1
,
3
,
1
);
INSERT
INTO
t2
VALUES
(
1
,
1
),
(
1
,
2
),
(
1
,
3
);
SELECT
field1
,
field2
,
COUNT
(
*
)
FROM
t1
GROUP
BY
field1
,
field2
;
SELECT
field1
,
field2
FROM
t1
GROUP
BY
field1
,
field2
HAVING
COUNT
(
*
)
>=
ALL
(
SELECT
fieldB
FROM
t2
WHERE
fieldA
=
field1
);
SELECT
field1
,
field2
FROM
t1
GROUP
BY
field1
,
field2
HAVING
COUNT
(
*
)
<
ANY
(
SELECT
fieldB
FROM
t2
WHERE
fieldA
=
field1
);
DROP
TABLE
t1
,
t2
;
# End of 4.1 tests
sql/item.cc
View file @
4716c99a
...
...
@@ -387,6 +387,7 @@ void Item::split_sum_func2(THD *thd, Item **ref_pointer_array,
}
else
if
((
type
()
==
SUM_FUNC_ITEM
||
(
used_tables
()
&
~
PARAM_TABLE_BIT
))
&&
type
()
!=
SUBSELECT_ITEM
&&
type
()
!=
REF_ITEM
)
{
/*
...
...
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