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
be96cc09
Commit
be96cc09
authored
Sep 03, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug #1172 - crash on force index() and SEL_ARG::MAYBE_KEY
parent
867b4cc1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
mysql-test/r/range.result
mysql-test/r/range.result
+13
-0
mysql-test/t/range.test
mysql-test/t/range.test
+11
-0
sql/opt_range.cc
sql/opt_range.cc
+2
-2
No files found.
mysql-test/r/range.result
View file @
be96cc09
...
...
@@ -260,3 +260,16 @@ explain select count(*) from t1 where x in (1,2);
table type possible_keys key key_len ref rows Extra
t1 range x x 5 NULL 2 Using where; Using index
drop table t1;
CREATE TABLE t1 (key1 int(11) NOT NULL default '0', KEY i1 (key1), KEY i2 (key1));
INSERT INTO t1 VALUES (0),(0),(1),(1);
CREATE TABLE t2 (keya int(11) NOT NULL default '0', KEY j1 (keya));
INSERT INTO t2 VALUES (0),(0),(1),(1),(2),(2);
explain select * from t1, t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
table type possible_keys key key_len ref rows Extra
t2 ref j1 j1 4 const 1 Using where; Using index
t1 ALL i1,i2 NULL NULL NULL 4 Range checked for each record (index map: 3)
explain select * from t1 force index(i2), t2 where (t1.key1 <t2.keya + 1) and t2.keya=3;
table type possible_keys key key_len ref rows Extra
t2 ref j1 j1 4 const 1 Using where; Using index
t1 ALL i2 NULL NULL NULL 4 Range checked for each record (index map: 2)
DROP TABLE t1,t2;
mysql-test/t/range.test
View file @
be96cc09
...
...
@@ -203,3 +203,14 @@ explain select count(*) from t1 where x in (1);
explain
select
count
(
*
)
from
t1
where
x
in
(
1
,
2
);
drop
table
t1
;
#
# bug #1172
#
CREATE
TABLE
t1
(
key1
int
(
11
)
NOT
NULL
default
'0'
,
KEY
i1
(
key1
),
KEY
i2
(
key1
));
INSERT
INTO
t1
VALUES
(
0
),(
0
),(
1
),(
1
);
CREATE
TABLE
t2
(
keya
int
(
11
)
NOT
NULL
default
'0'
,
KEY
j1
(
keya
));
INSERT
INTO
t2
VALUES
(
0
),(
0
),(
1
),(
1
),(
2
),(
2
);
explain
select
*
from
t1
,
t2
where
(
t1
.
key1
<
t2
.
keya
+
1
)
and
t2
.
keya
=
3
;
explain
select
*
from
t1
force
index
(
i2
),
t2
where
(
t1
.
key1
<
t2
.
keya
+
1
)
and
t2
.
keya
=
3
;
DROP
TABLE
t1
,
t2
;
sql/opt_range.cc
View file @
be96cc09
...
...
@@ -692,7 +692,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
uint
keynr
=
param
.
real_keynr
[
idx
];
if
((
*
key
)
->
type
==
SEL_ARG
::
MAYBE_KEY
||
(
*
key
)
->
maybe_flag
)
needed_reg
|=
(
key_map
)
1
<<
keynr
;
needed_reg
|=
(
key_map
)
1
<<
keynr
;
found_records
=
check_quick_select
(
&
param
,
idx
,
*
key
);
if
(
found_records
!=
HA_POS_ERROR
&&
found_records
>
2
&&
...
...
@@ -716,7 +716,7 @@ int SQL_SELECT::test_quick_select(key_map keys_to_use, table_map prev_tables,
param
.
range_count
,
found_records
)
+
(
double
)
found_records
/
TIME_FOR_COMPARE
);
if
(
read_time
>
found_read_time
)
if
(
read_time
>
found_read_time
&&
found_records
!=
HA_POS_ERROR
)
{
read_time
=
found_read_time
;
records
=
found_records
;
...
...
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