summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <svoj@mysql.com/june.mysql.com>2006-12-26 22:10:02 +0400
committerunknown <svoj@mysql.com/june.mysql.com>2006-12-26 22:10:02 +0400
commit901cbf0326caa9fd144d4fb872a542d0fa44b8f6 (patch)
treeb49c77eb5e542028189609368674fc3f9034ac16
parent552c3e62faf6bdd2a33f791bbed0b929d52cf424 (diff)
downloadmariadb-git-901cbf0326caa9fd144d4fb872a542d0fa44b8f6.tar.gz
After merge fix.
-rw-r--r--mysql-test/r/index_merge_myisam.result13
-rw-r--r--sql/opt_range.cc15
2 files changed, 22 insertions, 6 deletions
diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result
index 1c60e53a335..45dfe0af505 100644
--- a/mysql-test/r/index_merge_myisam.result
+++ b/mysql-test/r/index_merge_myisam.result
@@ -286,7 +286,7 @@ NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL
explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> system NULL NULL NULL NULL 1
-2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where
+2 DERIVED t1 index_merge i1,i2 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where; Using index
create table t3 like t0;
insert into t3 select * from t0;
alter table t3 add key9 int not null, add index i9(key9);
@@ -696,6 +696,17 @@ explain select a from t2 where a='ab';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 6 const 1 Using where
drop table t2;
+CREATE TABLE t1(c1 INT, c2 INT DEFAULT 0, c3 CHAR(255) DEFAULT '',
+KEY(c1), KEY(c2), KEY(c3));
+INSERT INTO t1(c1) VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
+INSERT INTO t1 VALUES(0,0,0);
+CREATE TABLE t2(c1 int);
+INSERT INTO t2 VALUES(1);
+DELETE t1 FROM t1,t2 WHERE t1.c1=0 AND t1.c2=0;
+SELECT * FROM t1;
+c1 c2 c3
+DROP TABLE t1,t2;
#---------------- Index merge test 2 -------------------------------------------
SET SESSION STORAGE_ENGINE = MyISAM;
drop table if exists t1,t2;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index fa575e73c39..577fec64e8d 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1002,6 +1002,11 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
if (file)
{
range_end();
+ if (head->key_read)
+ {
+ head->key_read= 0;
+ file->extra(HA_EXTRA_NO_KEYREAD);
+ }
if (free_file)
{
DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
@@ -1010,10 +1015,6 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
file->close();
delete file;
}
- else
- {
- file->extra(HA_EXTRA_NO_KEYREAD);
- }
}
delete_dynamic(&ranges); /* ranges are allocated in alloc */
free_root(&alloc,MYF(0));
@@ -1195,7 +1196,11 @@ end:
org_file= head->file;
head->file= file;
/* We don't have to set 'head->keyread' here as the 'file' is unique */
- head->mark_columns_used_by_index(index);
+ if (!head->no_keyread)
+ {
+ head->key_read= 1;
+ head->mark_columns_used_by_index(index);
+ }
head->prepare_for_position();
head->file= org_file;
bitmap_copy(&column_bitmap, head->read_set);