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
0d2e9112
Commit
0d2e9112
authored
18 years ago
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rurik.mysql.com:/home/igor/mysql-5.1
into rurik.mysql.com:/home/igor/dev/mysql-5.1-0
parents
1ec91193
28b7b96a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
mysql-test/r/having.result
mysql-test/r/having.result
+35
-0
mysql-test/t/having.test
mysql-test/t/having.test
+44
-0
sql/item.cc
sql/item.cc
+9
-0
No files found.
mysql-test/r/having.result
View file @
0d2e9112
...
...
@@ -359,3 +359,38 @@ group by s1 collate latin1_swedish_ci having s1 = 'y';
s1 count(s1)
y 1
drop table t1;
DROP SCHEMA IF EXISTS HU;
Warnings:
Note 1008 Can't drop database 'HU'; database doesn't exist
CREATE SCHEMA HU ;
USE HU ;
CREATE TABLE STAFF
(EMPNUM CHAR(3) NOT NULL UNIQUE,
EMPNAME CHAR(20),
GRADE DECIMAL(4),
CITY CHAR(15));
CREATE TABLE PROJ
(PNUM CHAR(3) NOT NULL UNIQUE,
PNAME CHAR(20),
PTYPE CHAR(6),
BUDGET DECIMAL(9),
CITY CHAR(15));
INSERT INTO STAFF VALUES ('E1','Alice',12,'Deale');
INSERT INTO STAFF VALUES ('E2','Betty',10,'Vienna');
INSERT INTO STAFF VALUES ('E3','Carmen',13,'Vienna');
INSERT INTO STAFF VALUES ('E4','Don',12,'Deale');
INSERT INTO STAFF VALUES ('E5','Ed',13,'Akron');
INSERT INTO PROJ VALUES ('P1','MXSS','Design',10000,'Deale');
INSERT INTO PROJ VALUES ('P2','CALM','Code',30000,'Vienna');
INSERT INTO PROJ VALUES ('P3','SDP','Test',30000,'Tampa');
INSERT INTO PROJ VALUES ('P4','SDP','Design',20000,'Deale');
INSERT INTO PROJ VALUES ('P5','IRM','Test',10000,'Vienna');
INSERT INTO PROJ VALUES ('P6','PAYR','Design',50000,'Deale');
SELECT EMPNUM, GRADE*1000
FROM HU.STAFF WHERE GRADE * 1000 >
ANY (SELECT SUM(BUDGET) FROM HU.PROJ
GROUP BY CITY, PTYPE
HAVING HU.PROJ.CITY = HU.STAFF.CITY);
EMPNUM GRADE*1000
E3 13000
DROP SCHEMA HU;
This diff is collapsed.
Click to expand it.
mysql-test/t/having.test
View file @
0d2e9112
...
...
@@ -347,3 +347,47 @@ group by s1 collate latin1_swedish_ci having s1 = 'y';
# MySQL returns: 1 row, with count(s1) = 1
drop
table
t1
;
#
# Bug #15917: unexpected complain for a name in having clause
# when the server is run on Windows or with --lower-case-table-names=1
#
DROP
SCHEMA
IF
EXISTS
HU
;
CREATE
SCHEMA
HU
;
USE
HU
;
CREATE
TABLE
STAFF
(
EMPNUM
CHAR
(
3
)
NOT
NULL
UNIQUE
,
EMPNAME
CHAR
(
20
),
GRADE
DECIMAL
(
4
),
CITY
CHAR
(
15
));
CREATE
TABLE
PROJ
(
PNUM
CHAR
(
3
)
NOT
NULL
UNIQUE
,
PNAME
CHAR
(
20
),
PTYPE
CHAR
(
6
),
BUDGET
DECIMAL
(
9
),
CITY
CHAR
(
15
));
INSERT
INTO
STAFF
VALUES
(
'E1'
,
'Alice'
,
12
,
'Deale'
);
INSERT
INTO
STAFF
VALUES
(
'E2'
,
'Betty'
,
10
,
'Vienna'
);
INSERT
INTO
STAFF
VALUES
(
'E3'
,
'Carmen'
,
13
,
'Vienna'
);
INSERT
INTO
STAFF
VALUES
(
'E4'
,
'Don'
,
12
,
'Deale'
);
INSERT
INTO
STAFF
VALUES
(
'E5'
,
'Ed'
,
13
,
'Akron'
);
INSERT
INTO
PROJ
VALUES
(
'P1'
,
'MXSS'
,
'Design'
,
10000
,
'Deale'
);
INSERT
INTO
PROJ
VALUES
(
'P2'
,
'CALM'
,
'Code'
,
30000
,
'Vienna'
);
INSERT
INTO
PROJ
VALUES
(
'P3'
,
'SDP'
,
'Test'
,
30000
,
'Tampa'
);
INSERT
INTO
PROJ
VALUES
(
'P4'
,
'SDP'
,
'Design'
,
20000
,
'Deale'
);
INSERT
INTO
PROJ
VALUES
(
'P5'
,
'IRM'
,
'Test'
,
10000
,
'Vienna'
);
INSERT
INTO
PROJ
VALUES
(
'P6'
,
'PAYR'
,
'Design'
,
50000
,
'Deale'
);
SELECT
EMPNUM
,
GRADE
*
1000
FROM
HU
.
STAFF
WHERE
GRADE
*
1000
>
ANY
(
SELECT
SUM
(
BUDGET
)
FROM
HU
.
PROJ
GROUP
BY
CITY
,
PTYPE
HAVING
HU
.
PROJ
.
CITY
=
HU
.
STAFF
.
CITY
);
DROP
SCHEMA
HU
;
This diff is collapsed.
Click to expand it.
sql/item.cc
View file @
0d2e9112
...
...
@@ -3061,6 +3061,7 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
int
found_match_degree
=
0
;
Item_ident
*
cur_field
;
int
cur_match_degree
=
0
;
char
name_buff
[
NAME_LEN
+
1
];
if
(
find_item
->
type
()
==
Item
::
FIELD_ITEM
||
find_item
->
type
()
==
Item
::
REF_ITEM
)
...
...
@@ -3072,6 +3073,14 @@ static Item** find_field_in_group_list(Item *find_item, ORDER *group_list)
else
return
NULL
;
if
(
db_name
&&
lower_case_table_names
)
{
/* Convert database to lower case for comparison */
strmake
(
name_buff
,
db_name
,
sizeof
(
name_buff
)
-
1
);
my_casedn_str
(
files_charset_info
,
name_buff
);
db_name
=
name_buff
;
}
DBUG_ASSERT
(
field_name
!=
0
);
for
(
ORDER
*
cur_group
=
group_list
;
cur_group
;
cur_group
=
cur_group
->
next
)
...
...
This diff is collapsed.
Click to expand it.
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