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
c150453b
Commit
c150453b
authored
May 06, 2004
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
ec33d794
f6dc9169
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
mysql-test/r/key.result
mysql-test/r/key.result
+13
-0
mysql-test/t/key.test
mysql-test/t/key.test
+12
-0
sql/sql_select.cc
sql/sql_select.cc
+2
-2
No files found.
mysql-test/r/key.result
View file @
c150453b
...
@@ -222,3 +222,16 @@ explain select 1 from t1 where id =2;
...
@@ -222,3 +222,16 @@ explain select 1 from t1 where id =2;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref id id 4 const 1 Using where; Using index
1 SIMPLE t1 ref id id 4 const 1 Using where; Using index
drop table t1;
drop table t1;
CREATE TABLE t1 (numeropost mediumint(8) unsigned NOT NULL default '0', numreponse int(10) unsigned NOT NULL auto_increment, PRIMARY KEY (numeropost,numreponse), UNIQUE KEY numreponse (numreponse));
INSERT INTO t1 (numeropost,numreponse) VALUES ('1','1'),('1','2'),('2','3'),('2','4');
SELECT numeropost FROM t1 WHERE numreponse='1';
numeropost
1
EXPLAIN SELECT numeropost FROM t1 WHERE numreponse='1';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const numreponse numreponse 4 const 1 Using index
FLUSH TABLES;
SELECT numeropost FROM t1 WHERE numreponse='1';
numeropost
1
drop table t1;
mysql-test/t/key.test
View file @
c150453b
...
@@ -216,3 +216,15 @@ explain select name from t1 where id =2;
...
@@ -216,3 +216,15 @@ explain select name from t1 where id =2;
ALTER
TABLE
t1
DROP
PRIMARY
KEY
,
ADD
INDEX
(
id
);
ALTER
TABLE
t1
DROP
PRIMARY
KEY
,
ADD
INDEX
(
id
);
explain
select
1
from
t1
where
id
=
2
;
explain
select
1
from
t1
where
id
=
2
;
drop
table
t1
;
drop
table
t1
;
#
# Test of problem with key read (Bug #3666)
#
CREATE
TABLE
t1
(
numeropost
mediumint
(
8
)
unsigned
NOT
NULL
default
'0'
,
numreponse
int
(
10
)
unsigned
NOT
NULL
auto_increment
,
PRIMARY
KEY
(
numeropost
,
numreponse
),
UNIQUE
KEY
numreponse
(
numreponse
));
INSERT
INTO
t1
(
numeropost
,
numreponse
)
VALUES
(
'1'
,
'1'
),(
'1'
,
'2'
),(
'2'
,
'3'
),(
'2'
,
'4'
);
SELECT
numeropost
FROM
t1
WHERE
numreponse
=
'1'
;
EXPLAIN
SELECT
numeropost
FROM
t1
WHERE
numreponse
=
'1'
;
FLUSH
TABLES
;
SELECT
numeropost
FROM
t1
WHERE
numreponse
=
'1'
;
drop
table
t1
;
sql/sql_select.cc
View file @
c150453b
...
@@ -3638,7 +3638,7 @@ make_join_readinfo(JOIN *join, uint options)
...
@@ -3638,7 +3638,7 @@ make_join_readinfo(JOIN *join, uint options)
table
->
status
=
STATUS_NO_RECORD
;
table
->
status
=
STATUS_NO_RECORD
;
tab
->
read_first_record
=
join_read_const
;
tab
->
read_first_record
=
join_read_const
;
tab
->
read_record
.
read_record
=
join_no_more_records
;
tab
->
read_record
.
read_record
=
join_no_more_records
;
if
(
table
->
used_keys
.
is_set
(
tab
->
index
)
&&
if
(
table
->
used_keys
.
is_set
(
tab
->
ref
.
key
)
&&
!
table
->
no_keyread
)
!
table
->
no_keyread
)
{
{
table
->
key_read
=
1
;
table
->
key_read
=
1
;
...
@@ -5967,7 +5967,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
...
@@ -5967,7 +5967,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
}
}
else
else
{
{
if
(
!
table
->
key_read
&&
table
->
used_keys
.
is_set
(
tab
->
index
)
&&
if
(
!
table
->
key_read
&&
table
->
used_keys
.
is_set
(
tab
->
ref
.
key
)
&&
!
table
->
no_keyread
)
!
table
->
no_keyread
)
{
{
table
->
key_read
=
1
;
table
->
key_read
=
1
;
...
...
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