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
9ebf3a33
Commit
9ebf3a33
authored
Dec 23, 2004
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for BUG#5401 (attempt 2)
parent
8fb20802
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
147 additions
and
7 deletions
+147
-7
innobase/row/row0sel.c
innobase/row/row0sel.c
+11
-7
mysql-test/r/index_merge_innodb.result
mysql-test/r/index_merge_innodb.result
+68
-0
mysql-test/t/index_merge_innodb.test
mysql-test/t/index_merge_innodb.test
+68
-0
No files found.
innobase/row/row0sel.c
View file @
9ebf3a33
...
@@ -2331,11 +2331,6 @@ row_sel_store_mysql_rec(
...
@@ -2331,11 +2331,6 @@ row_sel_store_mysql_rec(
prebuilt
->
blob_heap
=
NULL
;
prebuilt
->
blob_heap
=
NULL
;
}
}
/* MySQL assumes that all columns have the SQL NULL bit set unless it
is a nullable column with a non-NULL value */
memset
(
mysql_rec
,
0xFF
,
prebuilt
->
null_bitmap_len
);
for
(
i
=
0
;
i
<
prebuilt
->
n_template
;
i
++
)
{
for
(
i
=
0
;
i
<
prebuilt
->
n_template
;
i
++
)
{
templ
=
prebuilt
->
mysql_template
+
i
;
templ
=
prebuilt
->
mysql_template
+
i
;
...
@@ -2431,6 +2426,8 @@ row_sel_store_mysql_rec(
...
@@ -2431,6 +2426,8 @@ row_sel_store_mysql_rec(
bug number 154 in the MySQL bug database: GROUP BY
bug number 154 in the MySQL bug database: GROUP BY
and DISTINCT could treat NULL values inequal. */
and DISTINCT could treat NULL values inequal. */
mysql_rec
[
templ
->
mysql_null_byte_offset
]
|=
(
byte
)
(
templ
->
mysql_null_bit_mask
);
if
(
templ
->
type
==
DATA_VARCHAR
if
(
templ
->
type
==
DATA_VARCHAR
||
templ
->
type
==
DATA_CHAR
||
templ
->
type
==
DATA_CHAR
||
templ
->
type
==
DATA_BINARY
||
templ
->
type
==
DATA_BINARY
...
@@ -2734,6 +2731,7 @@ row_sel_pop_cached_row_for_mysql(
...
@@ -2734,6 +2731,7 @@ row_sel_pop_cached_row_for_mysql(
ulint
i
;
ulint
i
;
mysql_row_templ_t
*
templ
;
mysql_row_templ_t
*
templ
;
byte
*
cached_rec
;
byte
*
cached_rec
;
byte
null_byte
;
ut_ad
(
prebuilt
->
n_fetch_cached
>
0
);
ut_ad
(
prebuilt
->
n_fetch_cached
>
0
);
if
(
prebuilt
->
keep_other_fields_on_keyread
)
if
(
prebuilt
->
keep_other_fields_on_keyread
)
...
@@ -2749,10 +2747,16 @@ row_sel_pop_cached_row_for_mysql(
...
@@ -2749,10 +2747,16 @@ row_sel_pop_cached_row_for_mysql(
buf
+
templ
->
mysql_col_offset
,
buf
+
templ
->
mysql_col_offset
,
cached_rec
+
templ
->
mysql_col_offset
,
cached_rec
+
templ
->
mysql_col_offset
,
templ
->
mysql_col_len
);
templ
->
mysql_col_len
);
/* Copy NULL bit of the current field from cached_rec
to buf */
if
(
templ
->
mysql_null_bit_mask
)
if
(
templ
->
mysql_null_bit_mask
)
buf
[
templ
->
mysql_null_byte_offset
]
&=
{
null_byte
=
buf
[
templ
->
mysql_null_byte_offset
]
&
~
(
byte
)
templ
->
mysql_null_bit_mask
;
null_byte
|=
(
byte
)
templ
->
mysql_null_bit_mask
&
cached_rec
[
templ
->
mysql_null_byte_offset
];
cached_rec
[
templ
->
mysql_null_byte_offset
];
buf
[
templ
->
mysql_null_byte_offset
]
=
null_byte
;
}
}
}
}
}
else
else
...
...
mysql-test/r/index_merge_innodb.result
View file @
9ebf3a33
...
@@ -53,3 +53,71 @@ key1 key2 str1 zeroval str2 str3
...
@@ -53,3 +53,71 @@ key1 key2 str1 zeroval str2 str3
1 199 aaa 0 bbb 199-0_A
1 199 aaa 0 bbb 199-0_A
0 200 aaa 0 bbb 200-0_a
0 200 aaa 0 bbb 200-0_a
drop table t1;
drop table t1;
create table t1 (
pk integer not null auto_increment primary key,
key1 integer,
key2 integer not null,
filler char (200),
index (key1),
index (key2)
) engine=innodb;
show warnings;
Level Code Message
explain select pk from t1 where key1 = 1 and key2 = 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge key1,key2 key1,key2 5,4 NULL 1 Using intersect(key1,key2); Using where; Using index
select pk from t1 where key2 = 1 and key1 = 1;
pk
26
select pk from t1 ignore index(key1,key2) where key2 = 1 and key1 = 1;
pk
26
drop table t1;
create table t1 (
pk int primary key auto_increment,
key1a int,
key2a int,
key1b int,
key2b int,
dummy1 int,
dummy2 int,
dummy3 int,
dummy4 int,
key3a int,
key3b int,
filler1 char (200),
index i1(key1a, key1b),
index i2(key2a, key2b),
index i3(key3a, key3b)
) engine=innodb;
create table t2 (a int);
insert into t2 values (0),(1),(2),(3),(4),(NULL);
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select A.a, B.a, C.a, D.a, C.a, D.a from t2 A,t2 B,t2 C, t2 D;
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b)
select key1a, key1b, key2a, key2b, key3a, key3b from t1;
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
select count(*) from t1;
count(*)
5184
explain select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i2 i1,i2 10,10 NULL 3 Using intersect(i1,i2); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key2a = 2 and key2b is null;
count(*)
4
explain select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge i1,i3 i1,i3 10,10 NULL 3 Using intersect(i1,i3); Using where; Using index
select count(*) from t1 where
key1a = 2 and key1b is null and key3a = 2 and key3b is null;
count(*)
4
drop table t1,t2;
mysql-test/t/index_merge_innodb.test
View file @
9ebf3a33
...
@@ -51,4 +51,72 @@ select * from t1 where key1 < 5 or key2 > 197;
...
@@ -51,4 +51,72 @@ select * from t1 where key1 < 5 or key2 > 197;
explain
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
explain
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
select
*
from
t1
where
key1
<
3
or
key2
>
195
;
# Test for BUG#5401
drop
table
t1
;
drop
table
t1
;
create
table
t1
(
pk
integer
not
null
auto_increment
primary
key
,
key1
integer
,
key2
integer
not
null
,
filler
char
(
200
),
index
(
key1
),
index
(
key2
)
)
engine
=
innodb
;
show
warnings
;
--
disable_query_log
let
$
1
=
30
;
while
(
$
1
)
{
eval
insert
into
t1
(
key1
,
key2
,
filler
)
values
(
$
1
/
4
,
$
1
/
8
,
'filler-data'
);
dec
$
1
;
}
--
enable_query_log
explain
select
pk
from
t1
where
key1
=
1
and
key2
=
1
;
select
pk
from
t1
where
key2
=
1
and
key1
=
1
;
select
pk
from
t1
ignore
index
(
key1
,
key2
)
where
key2
=
1
and
key1
=
1
;
# More tests for BUG#5401.
drop
table
t1
;
create
table
t1
(
pk
int
primary
key
auto_increment
,
key1a
int
,
key2a
int
,
key1b
int
,
key2b
int
,
dummy1
int
,
dummy2
int
,
dummy3
int
,
dummy4
int
,
key3a
int
,
key3b
int
,
filler1
char
(
200
),
index
i1
(
key1a
,
key1b
),
index
i2
(
key2a
,
key2b
),
index
i3
(
key3a
,
key3b
)
)
engine
=
innodb
;
create
table
t2
(
a
int
);
insert
into
t2
values
(
0
),(
1
),(
2
),(
3
),(
4
),(
NULL
);
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
A
.
a
,
B
.
a
,
C
.
a
,
D
.
a
,
C
.
a
,
D
.
a
from
t2
A
,
t2
B
,
t2
C
,
t2
D
;
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
from
t1
;
insert
into
t1
(
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
)
select
key1a
,
key1b
,
key2a
,
key2b
,
key3a
,
key3b
from
t1
;
analyze
table
t1
;
select
count
(
*
)
from
t1
;
explain
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key2a
=
2
and
key2b
is
null
;
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key2a
=
2
and
key2b
is
null
;
explain
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key3a
=
2
and
key3b
is
null
;
select
count
(
*
)
from
t1
where
key1a
=
2
and
key1b
is
null
and
key3a
=
2
and
key3b
is
null
;
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