Commit 0eaf5750 authored by unknown's avatar unknown

Merge witty.ndb.mysql.com:/Users/mattiasj/clones/mysql-5.1-bug33379

into  witty.ndb.mysql.com:/Users/mattiasj/clones/51-topush


mysql-test/r/partition_datatype.result:
  Auto merged
mysql-test/t/partition_datatype.test:
  Auto merged
parents e1bb82bb 5a4274a7
...@@ -37,22 +37,22 @@ a ...@@ -37,22 +37,22 @@ a
2 2
drop table t1; drop table t1;
create table t1 (a float not null) partition by key (a); create table t1 (a float not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
0.5
drop table t1; drop table t1;
create table t1 (a double not null) partition by key (a); create table t1 (a double not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
2.1 0.5
drop table t1; drop table t1;
create table t1 (a decimal not null) partition by key (a); create table t1 (a decimal(4,2) not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
a a
2.10
drop table t1; drop table t1;
create table t1 (a date not null) partition by key (a); create table t1 (a date not null) partition by key (a);
insert into t1 values ('2001-01-01'); insert into t1 values ('2001-01-01');
...@@ -170,22 +170,22 @@ a ...@@ -170,22 +170,22 @@ a
2 2
drop table t1; drop table t1;
create table t1 (a float) partition by key (a); create table t1 (a float) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
0.5
drop table t1; drop table t1;
create table t1 (a double) partition by key (a); create table t1 (a double) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
a a
2.1 0.5
drop table t1; drop table t1;
create table t1 (a decimal) partition by key (a); create table t1 (a decimal(4,2)) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
Warnings:
Note 1265 Data truncated for column 'a' at row 1
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
a a
2.10
drop table t1; drop table t1;
create table t1 (a date) partition by key (a); create table t1 (a date) partition by key (a);
insert into t1 values ('2001-01-01'); insert into t1 values ('2001-01-01');
...@@ -268,25 +268,41 @@ drop table t1; ...@@ -268,25 +268,41 @@ drop table t1;
create table t1 (a varchar(65531)) partition by key (a); create table t1 (a varchar(65531)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a a
aaaa
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
a a
aaaa aaaa
select * from t1 where a = 'bbbb';
a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65532)) partition by key (a); create table t1 (a varchar(65532)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a a
aaaa
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
a a
aaaa aaaa
select * from t1 where a = 'bbbb';
a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65533) not null) partition by key (a); create table t1 (a varchar(65533) not null) partition by key (a);
insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
a
aaaa
select * from t1 where a like 'aaa%';
a
aaaa
select * from t1 where a = 'bbbb';
a a
bbbb
drop table t1; drop table t1;
create table t1 (a varchar(65533)) partition by key (a); create table t1 (a varchar(65533)) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
...@@ -294,3 +310,17 @@ create table t1 (a varchar(65534) not null) partition by key (a); ...@@ -294,3 +310,17 @@ create table t1 (a varchar(65534) not null) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
create table t1 (a varchar(65535)) partition by key (a); create table t1 (a varchar(65535)) partition by key (a);
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
create table t1 (a bit(27), primary key (a)) engine=myisam
partition by hash (a)
(partition p0, partition p1, partition p2);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bit(27) NOT NULL DEFAULT '\0\0\0\0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY HASH (a) (PARTITION p0 ENGINE = MyISAM, PARTITION p1 ENGINE = MyISAM, PARTITION p2 ENGINE = MyISAM) */
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
hex(a)
7
drop table t1;
...@@ -37,14 +37,14 @@ insert into t1 values (2); ...@@ -37,14 +37,14 @@ insert into t1 values (2);
select * from t1 where a = 2; select * from t1 where a = 2;
drop table t1; drop table t1;
create table t1 (a float not null) partition by key (a); create table t1 (a float not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
drop table t1; drop table t1;
create table t1 (a double not null) partition by key (a); create table t1 (a double not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
drop table t1; drop table t1;
create table t1 (a decimal not null) partition by key (a); create table t1 (a decimal(4,2) not null) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
drop table t1; drop table t1;
...@@ -126,14 +126,14 @@ insert into t1 values (2); ...@@ -126,14 +126,14 @@ insert into t1 values (2);
select * from t1 where a = 2; select * from t1 where a = 2;
drop table t1; drop table t1;
create table t1 (a float) partition by key (a); create table t1 (a float) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
drop table t1; drop table t1;
create table t1 (a double) partition by key (a); create table t1 (a double) partition by key (a);
insert into t1 values (2.1); insert into t1 values (0.5);
select * from t1 where a = 2.1; select * from t1 where a = 0.5;
drop table t1; drop table t1;
create table t1 (a decimal) partition by key (a); create table t1 (a decimal(4,2)) partition by key (a);
insert into t1 values (2.1); insert into t1 values (2.1);
select * from t1 where a = 2.1; select * from t1 where a = 2.1;
drop table t1; drop table t1;
...@@ -192,18 +192,23 @@ drop table t1; ...@@ -192,18 +192,23 @@ drop table t1;
create table t1 (a varchar(65531)) partition by key (a); create table t1 (a varchar(65531)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
select * from t1 where a = 'bbbb';
drop table t1; drop table t1;
create table t1 (a varchar(65532)) partition by key (a); create table t1 (a varchar(65532)) partition by key (a);
insert into t1 values ('bbbb'); insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
select * from t1 where a like 'aaa%'; select * from t1 where a like 'aaa%';
select * from t1 where a = 'bbbb';
drop table t1; drop table t1;
create table t1 (a varchar(65533) not null) partition by key (a); create table t1 (a varchar(65533) not null) partition by key (a);
insert into t1 values ('bbbb');
insert into t1 values ('aaaa'); insert into t1 values ('aaaa');
select * from t1 where a = 'aaa%'; select * from t1 where a = 'aaaa';
select * from t1 where a like 'aaa%';
select * from t1 where a = 'bbbb';
drop table t1; drop table t1;
-- error ER_TOO_BIG_ROWSIZE -- error ER_TOO_BIG_ROWSIZE
create table t1 (a varchar(65533)) partition by key (a); create table t1 (a varchar(65533)) partition by key (a);
...@@ -211,3 +216,14 @@ create table t1 (a varchar(65533)) partition by key (a); ...@@ -211,3 +216,14 @@ create table t1 (a varchar(65533)) partition by key (a);
create table t1 (a varchar(65534) not null) partition by key (a); create table t1 (a varchar(65534) not null) partition by key (a);
-- error ER_TOO_BIG_ROWSIZE -- error ER_TOO_BIG_ROWSIZE
create table t1 (a varchar(65535)) partition by key (a); create table t1 (a varchar(65535)) partition by key (a);
#
# Bug#34358: error in key_restore for bitfields with uneven bits
#
create table t1 (a bit(27), primary key (a)) engine=myisam
partition by hash (a)
(partition p0, partition p1, partition p2);
show create table t1;
insert into t1 values (1),(4),(7),(10),(13),(16),(19),(22),(25),(28),(31),(34);
select hex(a) from t1 where a = 7;
drop table t1;
...@@ -168,6 +168,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, ...@@ -168,6 +168,7 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
} }
for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++) for (key_part= key_info->key_part ; (int) key_length > 0 ; key_part++)
{ {
uchar used_uneven_bits= 0;
if (key_part->null_bit) if (key_part->null_bit)
{ {
if (*from_key++) if (*from_key++)
...@@ -186,6 +187,8 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, ...@@ -186,6 +187,8 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
set_rec_bits(bits, to_record + key_part->null_offset + set_rec_bits(bits, to_record + key_part->null_offset +
(key_part->null_bit == 128), (key_part->null_bit == 128),
field->bit_ofs, field->bit_len); field->bit_ofs, field->bit_len);
/* we have now used the byte with 'uneven' bits */
used_uneven_bits= 1;
} }
} }
if (key_part->key_part_flag & HA_BLOB_PART) if (key_part->key_part_flag & HA_BLOB_PART)
...@@ -222,7 +225,9 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info, ...@@ -222,7 +225,9 @@ void key_restore(uchar *to_record, uchar *from_key, KEY *key_info,
else else
{ {
length= min(key_length, key_part->length); length= min(key_length, key_part->length);
memcpy(to_record + key_part->offset, from_key, (size_t) length); /* skip the byte with 'uneven' bits, if used */
memcpy(to_record + key_part->offset, from_key + used_uneven_bits
, (size_t) length - used_uneven_bits);
} }
from_key+= length; from_key+= length;
key_length-= length; key_length-= length;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment