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
5624641c
Commit
5624641c
authored
Apr 26, 2005
by
ramil@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/usr/home/ram/work/5.0.b9489
parents
005c4471
db2b729c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
2 deletions
+74
-2
heap/hp_hash.c
heap/hp_hash.c
+11
-0
myisam/mi_key.c
myisam/mi_key.c
+3
-0
mysql-test/include/varchar.inc
mysql-test/include/varchar.inc
+10
-0
mysql-test/r/bdb.result
mysql-test/r/bdb.result
+9
-0
mysql-test/r/innodb.result
mysql-test/r/innodb.result
+9
-0
mysql-test/r/myisam.result
mysql-test/r/myisam.result
+9
-0
mysql-test/r/type_varchar.result
mysql-test/r/type_varchar.result
+10
-1
mysql-test/t/type_varchar.test
mysql-test/t/type_varchar.test
+13
-1
No files found.
heap/hp_hash.c
View file @
5624641c
...
...
@@ -255,6 +255,9 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if
(
*
pos
)
/* Found null */
{
nr
^=
(
nr
<<
1
)
|
1
;
/* Add key pack length (2) to key for VARCHAR segments */
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
key
+=
2
;
continue
;
}
pos
++
;
...
...
@@ -390,6 +393,9 @@ ulong hp_hashnr(register HP_KEYDEF *keydef, register const byte *key)
if
(
*
pos
)
{
nr
^=
(
nr
<<
1
)
|
1
;
/* Add key pack length (2) to key for VARCHAR segments */
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
key
+=
2
;
continue
;
}
pos
++
;
...
...
@@ -584,7 +590,12 @@ int hp_key_cmp(HP_KEYDEF *keydef, const byte *rec, const byte *key)
if
(
found_null
!=
(
int
)
*
key
++
)
return
1
;
if
(
found_null
)
{
/* Add key pack length (2) to key for VARCHAR segments */
if
(
seg
->
type
==
HA_KEYTYPE_VARTEXT1
)
key
+=
2
;
continue
;
}
}
if
(
seg
->
type
==
HA_KEYTYPE_TEXT
)
{
...
...
myisam/mi_key.c
View file @
5624641c
...
...
@@ -242,7 +242,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
{
k_length
-=
length
;
if
(
keyseg
->
flag
&
(
HA_VAR_LENGTH_PART
|
HA_BLOB_PART
))
{
k_length
-=
2
;
/* Skip length */
old
+=
2
;
}
continue
;
/* Found NULL */
}
}
...
...
mysql-test/include/varchar.inc
View file @
5624641c
...
...
@@ -226,3 +226,13 @@ create table t1 (v varchar(65530), key(v(10)));
insert
into
t1
values
(
repeat
(
'a'
,
65530
));
select
length
(
v
)
from
t1
where
v
=
repeat
(
'a'
,
65530
);
drop
table
t1
;
#
# Bug #9489: problem with hash indexes
#
create
table
t1
(
a
int
,
b
varchar
(
12
),
key
ba
(
b
,
a
));
insert
into
t1
values
(
1
,
'A'
),
(
20
,
NULL
);
explain
select
*
from
t1
where
a
=
20
and
b
is
null
;
select
*
from
t1
where
a
=
20
and
b
is
null
;
drop
table
t1
;
mysql-test/r/bdb.result
View file @
5624641c
...
...
@@ -1858,6 +1858,15 @@ select length(v) from t1 where v=repeat('a',65530);
length(v)
65530
drop table t1;
create table t1(a int, b varchar(12), key ba(b, a));
insert into t1 values (1, 'A'), (20, NULL);
explain select * from t1 where a=20 and b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where
select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 255 bytes
...
...
mysql-test/r/innodb.result
View file @
5624641c
...
...
@@ -2359,6 +2359,15 @@ select length(v) from t1 where v=repeat('a',65530);
length(v)
65530
drop table t1;
create table t1(a int, b varchar(12), key ba(b, a));
insert into t1 values (1, 'A'), (20, NULL);
explain select * from t1 where a=20 and b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
create table t1 (v varchar(65530), key(v));
ERROR HY000: Can't create table './test/t1' (errno: 139)
create table t1 (v varchar(65536));
...
...
mysql-test/r/myisam.result
View file @
5624641c
...
...
@@ -1157,6 +1157,15 @@ select length(v) from t1 where v=repeat('a',65530);
length(v)
65530
drop table t1;
create table t1(a int, b varchar(12), key ba(b, a));
insert into t1 values (1, 'A'), (20, NULL);
explain select * from t1 where a=20 and b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
select * from t1 where a=20 and b is null;
a b
20 NULL
drop table t1;
create table t1 (v varchar(65530), key(v));
Warnings:
Warning 1071 Specified key was too long; max key length is 1000 bytes
...
...
mysql-test/r/type_varchar.result
View file @
5624641c
drop table if exists t1;
drop table if exists t1
, t2
;
create table t1 (v varchar(30), c char(3), e enum('abc','def','ghi'), t text);
truncate table vchar;
show create table t1;
...
...
@@ -383,3 +383,12 @@ select * from t1;
pkcol othercol
test somethingelse
drop table t1;
create table t1 (a int, b varchar(12));
insert into t1 values (1, 'A'), (22, NULL);
create table t2 (a int);
insert into t2 values (22), (22);
select t1.a, t1.b, min(t1.b) from t1 inner join t2 ON t2.a = t1.a
group by t1.b, t1.a;
a b min(t1.b)
22 NULL NULL
drop table t1, t2;
mysql-test/t/type_varchar.test
View file @
5624641c
--
disable_warnings
drop
table
if
exists
t1
;
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
create
table
t1
(
v
varchar
(
30
),
c
char
(
3
),
e
enum
(
'abc'
,
'def'
,
'ghi'
),
t
text
);
...
...
@@ -106,3 +106,15 @@ insert into t1 values ('test', 'something');
update
t1
set
othercol
=
'somethingelse'
where
pkcol
=
'test'
;
select
*
from
t1
;
drop
table
t1
;
#
# Bug #9489: problems with key handling
#
create
table
t1
(
a
int
,
b
varchar
(
12
));
insert
into
t1
values
(
1
,
'A'
),
(
22
,
NULL
);
create
table
t2
(
a
int
);
insert
into
t2
values
(
22
),
(
22
);
select
t1
.
a
,
t1
.
b
,
min
(
t1
.
b
)
from
t1
inner
join
t2
ON
t2
.
a
=
t1
.
a
group
by
t1
.
b
,
t1
.
a
;
drop
table
t1
,
t2
;
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