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
3aad7243
Commit
3aad7243
authored
Jan 29, 2007
by
mhansson/martin@linux-st28.site
Browse files
Options
Browse Files
Download
Plain Diff
Merge mhansson@bk-internal:/home/bk/mysql-5.1-opt
into linux-st28.site:/home/martin/mysql/src/5.1o-bug20604-tp
parents
6391613d
6d7a6097
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
8 deletions
+51
-8
mysql-test/r/key.result
mysql-test/r/key.result
+7
-0
mysql-test/t/key.test
mysql-test/t/key.test
+11
-0
sql/sql_base.cc
sql/sql_base.cc
+6
-1
sql/sql_select.cc
sql/sql_select.cc
+6
-5
sql/table.h
sql/table.h
+21
-2
No files found.
mysql-test/r/key.result
View file @
3aad7243
...
@@ -482,3 +482,10 @@ alter table t1 drop index i3, drop index i2, drop index i1;
...
@@ -482,3 +482,10 @@ alter table t1 drop index i3, drop index i2, drop index i1;
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
alter table t1 add index i3 (c3), add index i2 (c2), add unique index i1 (c1);
ERROR 23000: Duplicate entry '1' for key 'i1'
ERROR 23000: Duplicate entry '1' for key 'i1'
drop table t1;
drop table t1;
CREATE TABLE t1( a TINYINT, KEY(a) ) ENGINE=MyISAM;
INSERT INTO t1 VALUES( 1 );
ALTER TABLE t1 DISABLE KEYS;
EXPLAIN SELECT MAX(a) FROM t1 FORCE INDEX(a);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
drop table t1;
mysql-test/t/key.test
View file @
3aad7243
...
@@ -442,3 +442,14 @@ alter table t1 drop index i3, drop index i2, drop index i1;
...
@@ -442,3 +442,14 @@ alter table t1 drop index i3, drop index i2, drop index i1;
alter
table
t1
add
index
i3
(
c3
),
add
index
i2
(
c2
),
add
unique
index
i1
(
c1
);
alter
table
t1
add
index
i3
(
c3
),
add
index
i2
(
c2
),
add
unique
index
i1
(
c1
);
drop
table
t1
;
drop
table
t1
;
#
# Bug #20604: Test for disabled keys with aggregate functions and FORCE INDEX.
#
CREATE
TABLE
t1
(
a
TINYINT
,
KEY
(
a
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
VALUES
(
1
);
ALTER
TABLE
t1
DISABLE
KEYS
;
EXPLAIN
SELECT
MAX
(
a
)
FROM
t1
FORCE
INDEX
(
a
);
drop
table
t1
;
sql/sql_base.cc
View file @
3aad7243
...
@@ -5462,7 +5462,12 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
...
@@ -5462,7 +5462,12 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
get_key_map_from_key_list
(
&
map
,
table
,
table_list
->
use_index
);
get_key_map_from_key_list
(
&
map
,
table
,
table_list
->
use_index
);
if
(
map
.
is_set_all
())
if
(
map
.
is_set_all
())
DBUG_RETURN
(
1
);
DBUG_RETURN
(
1
);
table
->
keys_in_use_for_query
=
map
;
/*
Don't introduce keys in keys_in_use_for_query that weren't there
before. FORCE/USE INDEX should not add keys, it should only remove
all keys except the key(s) specified in the hint.
*/
table
->
keys_in_use_for_query
.
intersect
(
map
);
}
}
if
(
table_list
->
ignore_index
)
if
(
table_list
->
ignore_index
)
{
{
...
...
sql/sql_select.cc
View file @
3aad7243
...
@@ -12262,13 +12262,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
...
@@ -12262,13 +12262,14 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
DBUG_ENTER
(
"test_if_skip_sort_order"
);
DBUG_ENTER
(
"test_if_skip_sort_order"
);
LINT_INIT
(
ref_key_parts
);
LINT_INIT
(
ref_key_parts
);
/* Check which keys can be used to resolve ORDER BY. */
usable_keys
=
table
->
keys_in_use_for_query
;
/*
/*
Check which keys can be used to resolve ORDER BY.
Keys disabled by ALTER TABLE ... DISABLE KEYS should have already
We must not try to use disabled keys
.
been taken into account
.
*/
*/
usable_keys
=
table
->
s
->
keys_in_use
;
DBUG_ASSERT
(
usable_keys
.
is_subset
(
table
->
s
->
keys_in_use
));
/* we must not consider keys that are disabled by IGNORE INDEX */
usable_keys
.
intersect
(
table
->
keys_in_use_for_query
);
for
(
ORDER
*
tmp_order
=
order
;
tmp_order
;
tmp_order
=
tmp_order
->
next
)
for
(
ORDER
*
tmp_order
=
order
;
tmp_order
;
tmp_order
=
tmp_order
->
next
)
{
{
...
...
sql/table.h
View file @
3aad7243
...
@@ -158,7 +158,12 @@ typedef struct st_table_share
...
@@ -158,7 +158,12 @@ typedef struct st_table_share
LEX_STRING
path
;
/* Path to .frm file (from datadir) */
LEX_STRING
path
;
/* Path to .frm file (from datadir) */
LEX_STRING
normalized_path
;
/* unpack_filename(path) */
LEX_STRING
normalized_path
;
/* unpack_filename(path) */
LEX_STRING
connect_string
;
LEX_STRING
connect_string
;
key_map
keys_in_use
;
/* Keys in use for table */
/*
Set of keys in use, implemented as a Bitmap.
Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
*/
key_map
keys_in_use
;
key_map
keys_for_keyread
;
key_map
keys_for_keyread
;
ha_rows
min_rows
,
max_rows
;
/* create information */
ha_rows
min_rows
,
max_rows
;
/* create information */
ulong
avg_row_length
;
/* create information */
ulong
avg_row_length
;
/* create information */
...
@@ -313,7 +318,21 @@ struct st_table {
...
@@ -313,7 +318,21 @@ struct st_table {
byte
*
write_row_record
;
/* Used as optimisation in
byte
*
write_row_record
;
/* Used as optimisation in
THD::write_row */
THD::write_row */
byte
*
insert_values
;
/* used by INSERT ... UPDATE */
byte
*
insert_values
;
/* used by INSERT ... UPDATE */
key_map
quick_keys
,
used_keys
,
keys_in_use_for_query
,
merge_keys
;
key_map
quick_keys
,
used_keys
;
/*
A set of keys that can be used in the query that references this
table
All indexes disabled on the table's TABLE_SHARE (see TABLE::s) will be
subtracted from this set upon instantiation. Thus for any TABLE t it holds
that t.keys_in_use_for_query is a subset of t.s.keys_in_use. Generally we
must not introduce any new keys here (see setup_tables).
The set is implemented as a bitmap.
*/
key_map
keys_in_use_for_query
;
key_map
merge_keys
;
KEY
*
key_info
;
/* data of keys in database */
KEY
*
key_info
;
/* data of keys in database */
Field
*
next_number_field
;
/* Set if next_number is activated */
Field
*
next_number_field
;
/* Set if next_number is activated */
...
...
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