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
f22fde21
Commit
f22fde21
authored
Dec 27, 2002
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed max_key_length when using UNIQUE keys.
This fixed a bug in GROUP BY on a BLOB column with NULL values.
parent
fc8a7895
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
myisam/mi_create.c
myisam/mi_create.c
+1
-1
myisam/mi_unique.c
myisam/mi_unique.c
+10
-1
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+8
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+11
-0
No files found.
myisam/mi_create.c
View file @
f22fde21
...
...
@@ -224,7 +224,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
if
(
uniques
)
{
max_key_block_length
=
MI_KEY_BLOCK_LENGTH
;
max_key_length
=
MI_UNIQUE_HASH_LENGTH
;
max_key_length
=
MI_UNIQUE_HASH_LENGTH
+
pointer
;
}
for
(
i
=
0
,
keydef
=
keydefs
;
i
<
keys
;
i
++
,
keydef
++
)
...
...
myisam/mi_unique.c
View file @
f22fde21
...
...
@@ -24,7 +24,7 @@ my_bool mi_check_unique(MI_INFO *info, MI_UNIQUEDEF *def, byte *record,
{
my_off_t
lastpos
=
info
->
lastpos
;
MI_KEYDEF
*
key
=
&
info
->
s
->
keyinfo
[
def
->
key
];
uchar
*
key_buff
=
info
->
lastkey
+
info
->
s
->
base
.
max_key_length
;
uchar
*
key_buff
=
info
->
lastkey
2
;
DBUG_ENTER
(
"mi_check_unique"
);
mi_unique_store
(
record
+
key
->
seg
->
start
,
unique_hash
);
...
...
@@ -80,7 +80,16 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const byte *record)
if
(
keyseg
->
null_bit
)
{
if
(
record
[
keyseg
->
null_pos
]
&
keyseg
->
null_bit
)
{
/*
Change crc in a way different from an empty string or 0.
(This is an optimisation; The code will work even if this isn't
done)
*/
crc
=
((
crc
<<
8
)
+
511
+
(
crc
>>
(
8
*
sizeof
(
ha_checksum
)
-
8
)));
continue
;
}
}
pos
=
record
+
keyseg
->
start
;
if
(
keyseg
->
flag
&
HA_VAR_LENGTH
)
...
...
mysql-test/r/group_by.result
View file @
f22fde21
...
...
@@ -102,3 +102,11 @@ pid c1id c2id value id active id active
1 4 NULL 4 4 Yes NULL NULL
max(value)
4
a count(*)
NULL 9
3
b 1
a count(*)
NULL 9
3
b 1
mysql-test/t/group_by.test
View file @
f22fde21
...
...
@@ -312,3 +312,14 @@ m.c1id = c1.id AND c1.active = 'Yes' LEFT JOIN t3 AS c2 ON m.c2id =
c2
.
id
AND
c2
.
active
=
'Yes'
WHERE
m
.
pid
=
1
AND
(
c1
.
id
IS
NOT
NULL
OR
c2
.
id
IS
NOT
NULL
);
drop
table
t1
,
t2
,
t3
;
#
# Test bug in GROUP BY on BLOB that is NULL or empty
#
create
table
t1
(
a
blob
null
);
insert
into
t1
values
(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
NULL
),(
""
),(
""
),(
""
),(
"b"
);
select
a
,
count
(
*
)
from
t1
group
by
a
;
set
option
sql_big_tables
=
1
;
select
a
,
count
(
*
)
from
t1
group
by
a
;
drop
table
t1
;
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