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
08e56fae
Commit
08e56fae
authored
Oct 05, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug #5555: "GROUP BY enum_field" returns incorrect results
parent
ab5c7a9e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
6 deletions
+52
-6
mysql-test/r/func_group.result
mysql-test/r/func_group.result
+26
-0
mysql-test/t/func_group.test
mysql-test/t/func_group.test
+24
-0
sql/ha_heap.cc
sql/ha_heap.cc
+2
-6
No files found.
mysql-test/r/func_group.result
View file @
08e56fae
...
...
@@ -693,3 +693,29 @@ SELECT MIN(a) FROM t1 WHERE a < 0;
MIN(a)
NULL
DROP TABLE t1;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val enum('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
val count(*)
one 2
two 2
three 1
drop table t1;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val set('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
val count(*)
one 2
two 2
three 1
drop table t1;
mysql-test/t/func_group.test
View file @
08e56fae
...
...
@@ -431,6 +431,30 @@ SELECT MIN(a) FROM t1 WHERE a < 0;
DROP
TABLE
t1
;
#
# Bug #5555 GROUP BY enum_field" returns incorrect results
#
CREATE
TABLE
t1
(
id
int
(
10
)
unsigned
NOT
NULL
auto_increment
,
val
enum
(
'one'
,
'two'
,
'three'
)
NOT
NULL
default
'one'
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t1
VALUES
(
1
,
'one'
),(
2
,
'two'
),(
3
,
'three'
),(
4
,
'one'
),(
5
,
'two'
);
select
val
,
count
(
*
)
from
t1
group
by
val
;
drop
table
t1
;
CREATE
TABLE
t1
(
id
int
(
10
)
unsigned
NOT
NULL
auto_increment
,
val
set
(
'one'
,
'two'
,
'three'
)
NOT
NULL
default
'one'
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
INSERT
INTO
t1
VALUES
(
1
,
'one'
),(
2
,
'two'
),(
3
,
'three'
),(
4
,
'one'
),(
5
,
'two'
);
select
val
,
count
(
*
)
from
t1
group
by
val
;
drop
table
t1
;
sql/ha_heap.cc
View file @
08e56fae
...
...
@@ -428,12 +428,8 @@ int ha_heap::create(const char *name, TABLE *table_arg,
seg
->
type
=
field
->
key_type
();
else
{
if
(
!
f_is_packed
(
flag
)
&&
f_packtype
(
flag
)
==
(
int
)
FIELD_TYPE_DECIMAL
&&
!
(
field
->
charset
()
==
&
my_charset_bin
))
seg
->
type
=
(
int
)
HA_KEYTYPE_TEXT
;
else
seg
->
type
=
(
int
)
HA_KEYTYPE_BINARY
;
if
((
seg
->
type
=
field
->
key_type
())
!=
(
int
)
HA_KEYTYPE_TEXT
)
seg
->
type
=
HA_KEYTYPE_BINARY
;
}
seg
->
start
=
(
uint
)
key_part
->
offset
;
seg
->
length
=
(
uint
)
key_part
->
length
;
...
...
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