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
6a4b2343
Commit
6a4b2343
authored
Jun 26, 2007
by
igor@olga.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge olga.mysql.com:/home/igor/mysql-5.0-opt
into olga.mysql.com:/home/igor/dev-opt/mysql-5.0-opt-bug29087
parents
8209199c
6f98ec66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
6 deletions
+82
-6
myisam/mi_key.c
myisam/mi_key.c
+6
-6
mysql-test/r/binary.result
mysql-test/r/binary.result
+38
-0
mysql-test/t/binary.test
mysql-test/t/binary.test
+38
-0
No files found.
myisam/mi_key.c
View file @
6a4b2343
...
...
@@ -252,16 +252,16 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
if
(
keyseg
->
flag
&
HA_SPACE_PACK
)
{
uchar
*
end
=
pos
+
length
;
if
(
type
!=
HA_KEYTYPE_NUM
)
{
while
(
end
>
pos
&&
end
[
-
1
]
==
' '
)
end
--
;
}
else
if
(
type
==
HA_KEYTYPE_NUM
)
{
while
(
pos
<
end
&&
pos
[
0
]
==
' '
)
pos
++
;
}
else
if
(
type
!=
HA_KEYTYPE_BINARY
)
{
while
(
end
>
pos
&&
end
[
-
1
]
==
' '
)
end
--
;
}
k_length
-=
length
;
length
=
(
uint
)
(
end
-
pos
);
FIX_LENGTH
(
cs
,
pos
,
length
,
char_length
);
...
...
mysql-test/r/binary.result
View file @
6a4b2343
...
...
@@ -160,3 +160,41 @@ hex(col1)
62000000000000000000
62200000000000000000
drop table t1;
CREATE TABLE t1 (
a binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
index idx(a)
);
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029087575');
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
INSERT INTO t1 SET a=unhex('1F9480179366F2BF567E1C4B964C1EF029080707');
SELECT hex(a) FROM t1 order by a;
hex(a)
1F9480179366F2BF567E1C4B964C1EF029080707
1F9480179366F2BF567E1C4B964C1EF029082020
1F9480179366F2BF567E1C4B964C1EF029087575
EXPLAIN SELECT hex(a) FROM t1 order by a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL idx 20 NULL 3 Using index
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
hex(a)
1F9480179366F2BF567E1C4B964C1EF029082020
EXPLAIN
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF029082020');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref idx idx 20 const 1 Using where; Using index
SELECT hex(a) from t1 WHERE a=unhex('1F9480179366F2BF567E1C4B964C1EF02908');
hex(a)
DROP TABLE t1;
CREATE TABLE t1 (
id numeric(20) NOT NULL,
lang varchar(8) NOT NULL,
msg varchar(32) NOT NULL,
PRIMARY KEY (id,lang)
);
INSERT INTO t1 VALUES (33, 'en', 'zzzzzzz');
INSERT INTO t1 VALUES (31, 'en', 'xxxxxxx');
INSERT INTO t1 VALUES (32, 'en', 'yyyyyyy');
SELECT * FROM t1 WHERE id=32;
id lang msg
32 en yyyyyyy
DROP TABLE t1;
mysql-test/t/binary.test
View file @
6a4b2343
...
...
@@ -101,3 +101,41 @@ select hex(col1) from t1;
insert
into
t1
values
(
'b'
),(
'b '
);
select
hex
(
col1
)
from
t1
;
drop
table
t1
;
#
# Bug #29087: assertion abort for a search in a BINARY non-nullable index
# by a key with trailing spaces
#
CREATE
TABLE
t1
(
a
binary
(
20
)
NOT
NULL
DEFAULT
'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
,
index
idx
(
a
)
);
INSERT
INTO
t1
SET
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF029087575'
);
INSERT
INTO
t1
SET
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF029082020'
);
INSERT
INTO
t1
SET
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF029080707'
);
SELECT
hex
(
a
)
FROM
t1
order
by
a
;
EXPLAIN
SELECT
hex
(
a
)
FROM
t1
order
by
a
;
SELECT
hex
(
a
)
from
t1
WHERE
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF029082020'
);
EXPLAIN
SELECT
hex
(
a
)
from
t1
WHERE
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF029082020'
);
SELECT
hex
(
a
)
from
t1
WHERE
a
=
unhex
(
'1F9480179366F2BF567E1C4B964C1EF02908'
);
DROP
TABLE
t1
;
CREATE
TABLE
t1
(
id
numeric
(
20
)
NOT
NULL
,
lang
varchar
(
8
)
NOT
NULL
,
msg
varchar
(
32
)
NOT
NULL
,
PRIMARY
KEY
(
id
,
lang
)
);
INSERT
INTO
t1
VALUES
(
33
,
'en'
,
'zzzzzzz'
);
INSERT
INTO
t1
VALUES
(
31
,
'en'
,
'xxxxxxx'
);
INSERT
INTO
t1
VALUES
(
32
,
'en'
,
'yyyyyyy'
);
SELECT
*
FROM
t1
WHERE
id
=
32
;
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