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
5b8683db
Commit
5b8683db
authored
Jul 04, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After merge fixes
parent
fe30ec90
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
65 deletions
+71
-65
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+28
-28
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+35
-33
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+7
-3
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-1
No files found.
mysql-test/r/group_by.result
View file @
5b8683db
...
...
@@ -723,6 +723,34 @@ WHERE hostname LIKE '%aol%'
hostname no
cache-dtc-af05.proxy.aol.com 1
DROP TABLE t1;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (1,3);
SELECT a, b FROM t1 GROUP BY 'const';
a b
1 2
SELECT DISTINCT a, b FROM t1 GROUP BY 'const';
a b
1 2
DROP TABLE t1;
CREATE TABLE t1 (id INT, dt DATETIME);
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f;
f id
20050501123000 1
DROP TABLE t1;
CREATE TABLE t1 (id varchar(20) NOT NULL);
INSERT INTO t1 VALUES ('trans1'), ('trans2');
CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL);
INSERT INTO t2 VALUES ('trans1', 'a problem');
SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY comment;
COUNT(DISTINCT(t1.id)) comment
1 NULL
1 a problem
DROP TABLE t1, t2;
CREATE TABLE t1 (n int);
INSERT INTO t1 VALUES (1);
SELECT n+1 AS n FROM t1 GROUP BY n;
...
...
@@ -752,31 +780,3 @@ aaa
show warnings;
Level Code Message
drop table t1, t2;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (1,3);
SELECT a, b FROM t1 GROUP BY 'const';
a b
1 2
SELECT DISTINCT a, b FROM t1 GROUP BY 'const';
a b
1 2
DROP TABLE t1;
CREATE TABLE t1 (id INT, dt DATETIME);
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
SELECT dt DIV 1 AS f, id FROM t1 GROUP BY f;
f id
20050501123000 1
DROP TABLE t1;
CREATE TABLE t1 (id varchar(20) NOT NULL);
INSERT INTO t1 VALUES ('trans1'), ('trans2');
CREATE TABLE t2 (id varchar(20) NOT NULL, err_comment blob NOT NULL);
INSERT INTO t2 VALUES ('trans1', 'a problem');
SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
FROM t1 LEFT JOIN t2 ON t1.id=t2.id GROUP BY comment;
COUNT(DISTINCT(t1.id)) comment
1 NULL
1 a problem
DROP TABLE t1, t2;
mysql-test/t/group_by.test
View file @
5b8683db
...
...
@@ -543,39 +543,6 @@ SELECT hostname, COUNT(DISTINCT user_id) as no FROM t1
DROP
TABLE
t1
;
#
# Bug#11211: Ambiguous column reference in GROUP BY.
#
create
table
t1
(
c1
char
(
3
),
c2
char
(
3
));
create
table
t2
(
c3
char
(
3
),
c4
char
(
3
));
insert
into
t1
values
(
'aaa'
,
'bb1'
),
(
'aaa'
,
'bb2'
);
insert
into
t2
values
(
'aaa'
,
'bb1'
),
(
'aaa'
,
'bb2'
);
# query with ambiguous column reference 'c2'
--
disable_ps_protocol
select
t1
.
c1
as
c2
from
t1
,
t2
where
t1
.
c2
=
t2
.
c4
group
by
c2
;
show
warnings
;
--
enable_ps_protocol
# this query has no ambiguity
select
t1
.
c1
as
c2
from
t1
,
t2
where
t1
.
c2
=
t2
.
c4
group
by
t1
.
c1
;
show
warnings
;
drop
table
t1
,
t2
;
#
# Test for bug #11414: crash on Windows for a simple GROUP BY query
#
CREATE
TABLE
t1
(
n
int
);
INSERT
INTO
t1
VALUES
(
1
);
--
disable_ps_protocol
SELECT
n
+
1
AS
n
FROM
t1
GROUP
BY
n
;
--
enable_ps_protocol
DROP
TABLE
t1
;
# Test for bug #8614: GROUP BY 'const' with DISTINCT
#
...
...
@@ -613,3 +580,38 @@ SELECT COUNT(DISTINCT(t1.id)), LEFT(err_comment, 256) AS comment
FROM
t1
LEFT
JOIN
t2
ON
t1
.
id
=
t2
.
id
GROUP
BY
comment
;
DROP
TABLE
t1
,
t2
;
#
# Test for bug #11414: crash on Windows for a simple GROUP BY query
#
CREATE
TABLE
t1
(
n
int
);
INSERT
INTO
t1
VALUES
(
1
);
--
disable_ps_protocol
SELECT
n
+
1
AS
n
FROM
t1
GROUP
BY
n
;
--
enable_ps_protocol
DROP
TABLE
t1
;
#
# Bug#11211: Ambiguous column reference in GROUP BY.
#
create
table
t1
(
c1
char
(
3
),
c2
char
(
3
));
create
table
t2
(
c3
char
(
3
),
c4
char
(
3
));
insert
into
t1
values
(
'aaa'
,
'bb1'
),
(
'aaa'
,
'bb2'
);
insert
into
t2
values
(
'aaa'
,
'bb1'
),
(
'aaa'
,
'bb2'
);
# query with ambiguous column reference 'c2'
--
disable_ps_protocol
select
t1
.
c1
as
c2
from
t1
,
t2
where
t1
.
c2
=
t2
.
c4
group
by
c2
;
show
warnings
;
--
enable_ps_protocol
# this query has no ambiguity
select
t1
.
c1
as
c2
from
t1
,
t2
where
t1
.
c2
=
t2
.
c4
group
by
t1
.
c1
;
show
warnings
;
drop
table
t1
,
t2
;
sql/item_cmpfunc.cc
View file @
5b8683db
...
...
@@ -1578,17 +1578,21 @@ my_decimal *Item_func_case::val_decimal(my_decimal *decimal_value)
}
bool
Item_func_case
::
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tables
,
Item
**
ref
)
bool
Item_func_case
::
fix_fields
(
THD
*
thd
,
Item
**
ref
)
{
/*
buff should match stack usage from
Item_func_case::val_int() -> Item_func_case::find_item()
*/
char
buff
[
MAX_FIELD_WIDTH
*
2
+
sizeof
(
String
)
*
2
+
sizeof
(
String
*
)
*
2
+
sizeof
(
double
)
*
2
+
sizeof
(
longlong
)
*
2
];
bool
res
=
Item_func
::
fix_fields
(
thd
,
ref
);
/*
Call check_stack_overrun after fix_fields to be sure that stack variable
is not optimized away
*/
if
(
check_stack_overrun
(
thd
,
STACK_MIN_SIZE
,
buff
))
return
TRUE
;
// Fatal error flag is set!
return
Item_func
::
fix_fields
(
thd
,
tables
,
ref
)
;
return
res
;
}
...
...
sql/item_cmpfunc.h
View file @
5b8683db
...
...
@@ -566,7 +566,7 @@ public:
longlong
val_int
();
String
*
val_str
(
String
*
);
my_decimal
*
val_decimal
(
my_decimal
*
);
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
,
Item
**
ref
);
bool
fix_fields
(
THD
*
thd
,
Item
**
ref
);
void
fix_length_and_dec
();
uint
decimal_precision
()
const
;
table_map
not_null_tables
()
const
{
return
0
;
}
...
...
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