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
c3fb3635
Commit
c3fb3635
authored
Jun 21, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge ibabaev@bk-internal.mysql.com:/home/bk/mysql-5.0
into rurik.mysql.com:/home/igor/mysql-5.0
parents
17c3f159
50f40a62
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
47 deletions
+27
-47
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+10
-21
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+15
-24
sql/item_buff.cc
sql/item_buff.cc
+2
-2
No files found.
mysql-test/r/group_by.result
View file @
c3fb3635
...
...
@@ -723,27 +723,6 @@ WHERE hostname LIKE '%aol%'
hostname no
cache-dtc-af05.proxy.aol.com 1
DROP TABLE t1;
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');
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by c2;
c2
aaa
aaa
Warnings:
Warning 1052 Column 'c2' in group statement is ambiguous
show warnings;
Level Code Message
Warning 1052 Column 'c2' in group statement is ambiguous
select t1.c1 as c2 from t1, t2 where t1.c2 = t2.c4
group by t1.c1;
c2
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';
...
...
@@ -762,3 +741,13 @@ 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 @
c3fb3635
...
...
@@ -542,30 +542,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 #8614: GROUP BY 'const' with DISTINCT
#
...
...
@@ -589,3 +565,18 @@ INSERT INTO t1 VALUES ( 1, '2005-05-01 12:30:00' );
SELECT
dt
DIV
1
AS
f
,
id
FROM
t1
GROUP
BY
f
;
DROP
TABLE
t1
;
#
# Test for bug #11295: GROUP BY a BLOB column with COUNT(DISTINCT column1)
# when the BLOB column takes NULL values
#
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
;
DROP
TABLE
t1
,
t2
;
sql/item_buff.cc
View file @
c3fb3635
...
...
@@ -60,8 +60,8 @@ bool Cached_item_str::cmp(void)
String
*
res
;
bool
tmp
;
res
=
item
->
val_str
(
&
tmp_value
);
res
->
length
(
min
(
res
->
length
(),
value
.
alloced_length
()));
if
((
res
=
item
->
val_str
(
&
tmp_value
)))
res
->
length
(
min
(
res
->
length
(),
value
.
alloced_length
()));
if
(
null_value
!=
item
->
null_value
)
{
if
((
null_value
=
item
->
null_value
))
...
...
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