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
0bf584d9
Commit
0bf584d9
authored
Nov 29, 2004
by
sergefp@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix and testcase for BUG#6699
parent
cb538e45
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
11 deletions
+69
-11
myisam/mi_rnext_same.c
myisam/mi_rnext_same.c
+4
-0
myisammrg/myrg_rnext_same.c
myisammrg/myrg_rnext_same.c
+22
-11
mysql-test/r/merge.result
mysql-test/r/merge.result
+25
-0
mysql-test/t/merge.test
mysql-test/t/merge.test
+18
-0
No files found.
myisam/mi_rnext_same.c
View file @
0bf584d9
...
@@ -88,6 +88,10 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
...
@@ -88,6 +88,10 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
if
(
my_errno
==
HA_ERR_KEY_NOT_FOUND
)
if
(
my_errno
==
HA_ERR_KEY_NOT_FOUND
)
my_errno
=
HA_ERR_END_OF_FILE
;
my_errno
=
HA_ERR_END_OF_FILE
;
}
}
else
if
(
!
buf
)
{
DBUG_RETURN
(
info
->
lastpos
==
HA_OFFSET_ERROR
?
my_errno
:
0
);
}
else
if
(
!
(
*
info
->
read_record
)(
info
,
info
->
lastpos
,
buf
))
else
if
(
!
(
*
info
->
read_record
)(
info
,
info
->
lastpos
,
buf
))
{
{
info
->
update
|=
HA_STATE_AKTIV
;
/* Record is read */
info
->
update
|=
HA_STATE_AKTIV
;
/* Record is read */
...
...
myisammrg/myrg_rnext_same.c
View file @
0bf584d9
...
@@ -16,25 +16,36 @@
...
@@ -16,25 +16,36 @@
#include "myrg_def.h"
#include "myrg_def.h"
int
myrg_rnext_same
(
MYRG_INFO
*
info
,
byte
*
buf
)
int
myrg_rnext_same
(
MYRG_INFO
*
info
,
byte
*
buf
)
{
{
u
int
err
;
int
err
;
MI_INFO
*
mi
;
MI_INFO
*
mi
;
if
(
!
info
->
current_table
)
if
(
!
info
->
current_table
)
return
(
HA_ERR_KEY_NOT_FOUND
);
return
(
HA_ERR_KEY_NOT_FOUND
);
err
=
mi_rnext_same
(
info
->
current_table
->
table
,
buf
);
/* at first, do rnext for the table found before */
if
((
err
=
mi_rnext_same
(
info
->
current_table
->
table
,
NULL
)))
{
if
(
err
==
HA_ERR_END_OF_FILE
)
if
(
err
==
HA_ERR_END_OF_FILE
)
{
{
queue_remove
(
&
(
info
->
by_key
),
0
);
queue_remove
(
&
(
info
->
by_key
),
0
);
if
(
!
info
->
by_key
.
elements
)
if
(
!
info
->
by_key
.
elements
)
return
HA_ERR_END_OF_FILE
;
return
HA_ERR_END_OF_FILE
;
mi
=
(
info
->
current_table
=
(
MYRG_TABLE
*
)
queue_top
(
&
(
info
->
by_key
)))
->
table
;
mi
->
once_flags
|=
RRND_PRESERVE_LASTINX
;
return
mi_rrnd
(
mi
,
buf
,
mi
->
lastpos
);
}
}
else
return
err
;
return
err
;
}
else
{
/* Found here, adding to queue */
queue_top
(
&
(
info
->
by_key
))
=
(
byte
*
)(
info
->
current_table
);
queue_replaced
(
&
(
info
->
by_key
));
}
/* now, mymerge's read_next is as simple as one queue_top */
mi
=
(
info
->
current_table
=
(
MYRG_TABLE
*
)
queue_top
(
&
(
info
->
by_key
)))
->
table
;
return
_myrg_mi_read_record
(
mi
,
buf
);
}
}
mysql-test/r/merge.result
View file @
0bf584d9
...
@@ -651,3 +651,28 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
...
@@ -651,3 +651,28 @@ ERROR HY000: You can't specify target table 't1' for update in FROM clause
create table t3 engine=merge union=(t1, t2) select * from t2;
create table t3 engine=merge union=(t1, t2) select * from t2;
ERROR HY000: You can't specify target table 't2' for update in FROM clause
ERROR HY000: You can't specify target table 't2' for update in FROM clause
drop table t1, t2;
drop table t1, t2;
create table t1 (a int,b int,c int, index (a,b,c));
create table t2 (a int,b int,c int, index (a,b,c));
create table t3 (a int,b int,c int, index (a,b,c))
engine=merge union=(t1 ,t2);
insert into t1 (a,b,c) values (1,1,0),(1,2,0);
insert into t2 (a,b,c) values (1,1,1),(1,2,1);
explain select a,b,c from t3 force index (a) where a=1 order by a,b,c;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
select a,b,c from t3 force index (a) where a=1 order by a,b,c;
a b c
1 1 0
1 1 1
1 2 0
1 2 1
explain select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ref a a 5 const 2 Using where; Using index
select a,b,c from t3 force index (a) where a=1 order by a desc, b desc, c desc;
a b c
1 2 1
1 2 0
1 1 1
1 1 0
drop table t1, t2, t3;
mysql-test/t/merge.test
View file @
0bf584d9
...
@@ -285,3 +285,21 @@ create table t3 engine=merge union=(t1, t2) select * from t1;
...
@@ -285,3 +285,21 @@ create table t3 engine=merge union=(t1, t2) select * from t1;
--
error
1093
--
error
1093
create
table
t3
engine
=
merge
union
=
(
t1
,
t2
)
select
*
from
t2
;
create
table
t3
engine
=
merge
union
=
(
t1
,
t2
)
select
*
from
t2
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
# BUG#6699 : no sorting on 'ref' retrieval
create
table
t1
(
a
int
,
b
int
,
c
int
,
index
(
a
,
b
,
c
));
create
table
t2
(
a
int
,
b
int
,
c
int
,
index
(
a
,
b
,
c
));
create
table
t3
(
a
int
,
b
int
,
c
int
,
index
(
a
,
b
,
c
))
engine
=
merge
union
=
(
t1
,
t2
);
insert
into
t1
(
a
,
b
,
c
)
values
(
1
,
1
,
0
),(
1
,
2
,
0
);
insert
into
t2
(
a
,
b
,
c
)
values
(
1
,
1
,
1
),(
1
,
2
,
1
);
explain
select
a
,
b
,
c
from
t3
force
index
(
a
)
where
a
=
1
order
by
a
,
b
,
c
;
select
a
,
b
,
c
from
t3
force
index
(
a
)
where
a
=
1
order
by
a
,
b
,
c
;
# this actually wasn't affected:
explain
select
a
,
b
,
c
from
t3
force
index
(
a
)
where
a
=
1
order
by
a
desc
,
b
desc
,
c
desc
;
select
a
,
b
,
c
from
t3
force
index
(
a
)
where
a
=
1
order
by
a
desc
,
b
desc
,
c
desc
;
drop
table
t1
,
t2
,
t3
;
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