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
b9f848c7
Commit
b9f848c7
authored
Dec 08, 2008
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
merged bug 37742 to 5.1-bugteam
parents
057323a7
f486bfbb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
1 deletion
+127
-1
mysql-test/r/innodb_mysql.result
mysql-test/r/innodb_mysql.result
+85
-0
mysql-test/t/innodb_mysql.test
mysql-test/t/innodb_mysql.test
+39
-0
sql/table.cc
sql/table.cc
+3
-1
No files found.
mysql-test/r/innodb_mysql.result
View file @
b9f848c7
...
...
@@ -1683,3 +1683,88 @@ CREATE INDEX i1 on t1 (a(3));
SELECT * FROM t1 WHERE a = 'abcde';
a
DROP TABLE t1;
CREATE TABLE foo (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=innodb;
CREATE TABLE foo2 (a int, b int, c char(10),
PRIMARY KEY (c),
KEY b (b)
) engine=innodb;
CREATE TABLE bar (a int, b int, c char(10),
PRIMARY KEY (c(3)),
KEY b (b)
) engine=myisam;
INSERT INTO foo VALUES
(1,2,'abcdefghij'), (2,3,''), (3,4,'klmnopqrst'),
(4,5,'uvwxyz'), (5,6,'meotnsyglt'), (4,5,'asfdewe');
INSERT INTO bar SELECT * FROM foo;
INSERT INTO foo2 SELECT * FROM foo;
EXPLAIN SELECT c FROM bar WHERE b>2;;
id 1
select_type SIMPLE
table bar
type ALL
possible_keys b
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo WHERE b>2;;
id 1
select_type SIMPLE
table foo
type ALL
possible_keys b
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo2 WHERE b>2;;
id 1
select_type SIMPLE
table foo2
type range
possible_keys b
key b
key_len 5
ref NULL
rows 3
Extra Using where; Using index
EXPLAIN SELECT c FROM bar WHERE c>2;;
id 1
select_type SIMPLE
table bar
type ALL
possible_keys PRIMARY
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo WHERE c>2;;
id 1
select_type SIMPLE
table foo
type ALL
possible_keys PRIMARY
key NULL
key_len NULL
ref NULL
rows 6
Extra Using where
EXPLAIN SELECT c FROM foo2 WHERE c>2;;
id 1
select_type SIMPLE
table foo2
type index
possible_keys PRIMARY
key b
key_len 5
ref NULL
rows 6
Extra Using where; Using index
DROP TABLE foo, bar, foo2;
End of 5.1 tests
mysql-test/t/innodb_mysql.test
View file @
b9f848c7
...
...
@@ -53,3 +53,42 @@ CREATE TABLE t1 (a char(50)) ENGINE=InnoDB;
CREATE
INDEX
i1
on
t1
(
a
(
3
));
SELECT
*
FROM
t1
WHERE
a
=
'abcde'
;
DROP
TABLE
t1
;
#
# Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of
# requested column
#
CREATE
TABLE
foo
(
a
int
,
b
int
,
c
char
(
10
),
PRIMARY
KEY
(
c
(
3
)),
KEY
b
(
b
)
)
engine
=
innodb
;
CREATE
TABLE
foo2
(
a
int
,
b
int
,
c
char
(
10
),
PRIMARY
KEY
(
c
),
KEY
b
(
b
)
)
engine
=
innodb
;
CREATE
TABLE
bar
(
a
int
,
b
int
,
c
char
(
10
),
PRIMARY
KEY
(
c
(
3
)),
KEY
b
(
b
)
)
engine
=
myisam
;
INSERT
INTO
foo
VALUES
(
1
,
2
,
'abcdefghij'
),
(
2
,
3
,
''
),
(
3
,
4
,
'klmnopqrst'
),
(
4
,
5
,
'uvwxyz'
),
(
5
,
6
,
'meotnsyglt'
),
(
4
,
5
,
'asfdewe'
);
INSERT
INTO
bar
SELECT
*
FROM
foo
;
INSERT
INTO
foo2
SELECT
*
FROM
foo
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
bar
WHERE
b
>
2
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
foo
WHERE
b
>
2
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
foo2
WHERE
b
>
2
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
bar
WHERE
c
>
2
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
foo
WHERE
c
>
2
;
--
query_vertical
EXPLAIN
SELECT
c
FROM
foo2
WHERE
c
>
2
;
DROP
TABLE
foo
,
bar
,
foo2
;
--
echo
End
of
5.1
tests
sql/table.cc
View file @
b9f848c7
...
...
@@ -1416,7 +1416,9 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
*/
if
(
ha_option
&
HA_PRIMARY_KEY_IN_READ_INDEX
)
{
field
->
part_of_key
=
share
->
keys_in_use
;
if
(
field
->
key_length
()
==
key_part
->
length
&&
!
(
field
->
flags
&
BLOB_FLAG
))
field
->
part_of_key
=
share
->
keys_in_use
;
if
(
field
->
part_of_sortkey
.
is_set
(
key
))
field
->
part_of_sortkey
=
share
->
keys_in_use
;
}
...
...
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