Commit b63e25d5 authored by unknown's avatar unknown
Browse files

Merge mysql.com:/home/mydev/mysql-5.0-bug14980

into  mysql.com:/home/mydev/mysql-5.1-bug14980


include/my_base.h:
  Auto merged
mysql-test/r/myisam.result:
  Auto merged
storage/myisam/mi_delete.c:
  Auto merged
storage/myisam/mi_key.c:
  Auto merged
storage/myisam/mi_rnext_same.c:
  Auto merged
storage/myisam/mi_unique.c:
  Auto merged
storage/myisam/mi_update.c:
  Auto merged
storage/myisam/mi_write.c:
  Auto merged
parents 54715b8b cefb1dc2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -423,7 +423,7 @@ enum ha_base_keytype {
#define HA_STATE_BUFF_SAVED	512	/* If current keybuff is info->buff */
#define HA_STATE_ROW_CHANGED	1024	/* To invalide ROW cache */
#define HA_STATE_EXTEND_BLOCK	2048
#define HA_STATE_RNEXT_SAME	4096	/* rnext_same was called */
#define HA_STATE_RNEXT_SAME	4096	/* rnext_same occupied lastkey2 */

/* myisampack expects no more than 32 field types. */
enum en_fieldtype {
+18 −0
Original line number Diff line number Diff line
@@ -729,6 +729,24 @@ select * from t1 where bob is null and cip=1;
cip	time	score	bob
1	00:01:00	0	NULL
drop table t1;
create table t1 (
id1 int not null auto_increment,
id2 int not null default '0',
t text not null,
primary key  (id1),
key x (id2, t(32))
) engine=myisam;
insert into t1 (id2, t) values
(10, 'abc'), (10, 'abc'), (10, 'abc'),
(20, 'abc'), (20, 'abc'), (20, 'def'),
(10, 'abc'), (10, 'abc');
select count(*)   from t1 where id2 = 10;
count(*)
5
select count(id1) from t1 where id2 = 10;
count(id1)
5
drop table t1;
set storage_engine=MyISAM;
drop table if exists t1,t2,t3;
--- Testing varchar ---
+19 −0
Original line number Diff line number Diff line
@@ -678,6 +678,25 @@ select * from t1 where bob is null and cip=1;
create index bug on t1 (bob(22), cip, time);
select * from t1 where bob is null and cip=1;
drop table t1;

#
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
#
create table t1 (
  id1 int not null auto_increment,
  id2 int not null default '0',
  t text not null,
  primary key  (id1),
  key x (id2, t(32))
) engine=myisam;
insert into t1 (id2, t) values
(10, 'abc'), (10, 'abc'), (10, 'abc'),
(20, 'abc'), (20, 'abc'), (20, 'def'),
(10, 'abc'), (10, 'abc');
select count(*)   from t1 where id2 = 10;
select count(id1) from t1 where id2 = 10;
drop table t1;

# End of 4.1 tests

#
+2 −0
Original line number Diff line number Diff line
@@ -88,6 +88,8 @@ int mi_delete(MI_INFO *info,const byte *record)
                _mi_make_key(info,i,old_key,record,info->lastpos)))
          goto err;
      }
      /* The above changed info->lastkey2. Inform mi_rnext_same(). */
      info->update&= ~HA_STATE_RNEXT_SAME;
    }
  }

+4 −0
Original line number Diff line number Diff line
@@ -444,6 +444,10 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr,
	     (char*) &blob_ptr,sizeof(char*));
      memcpy(blob_ptr,key,length);
      blob_ptr+=length;

      /* The above changed info->lastkey2. Inform mi_rnext_same(). */
      info->update&= ~HA_STATE_RNEXT_SAME;

      _my_store_blob_length(record+keyseg->start,
			    (uint) keyseg->bit_start,length);
      key+=length;
Loading