Commit 9e3d5993 authored by Sergey Glukhov's avatar Sergey Glukhov

5.0-bugteam->5.1-bugteam merge

parents 3929de56 0294c8bd
...@@ -996,6 +996,22 @@ SELECT * FROM t1; ...@@ -996,6 +996,22 @@ SELECT * FROM t1;
v b v b
abc 5 abc 5
DROP TABLE t1; DROP TABLE t1;
create table t1 (a tinytext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create table t1 (a mediumtext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
End of 5.0 tests End of 5.0 tests
drop table if exists t1, t2, t3; drop table if exists t1, t2, t3;
create table t1 (i int); create table t1 (i int);
......
...@@ -723,6 +723,32 @@ CREATE TABLE IF NOT EXISTS t1 ( ...@@ -723,6 +723,32 @@ CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'' f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
ERROR 42000: Invalid default value for 'f1' ERROR 42000: Invalid default value for 'f1'
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
create table t2bit7 (b1 bit(7)) engine=MyISAM;
insert into t1bit7 values (b'1100000');
insert into t1bit7 values (b'1100001');
insert into t1bit7 values (b'1100010');
insert into t2bit7 values (b'1100001');
insert into t2bit7 values (b'1100010');
insert into t2bit7 values (b'1100110');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
1100001
1100010
drop table t1bit7, t2bit7;
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
create table t2bit7 (b1 bit(15)) engine=MyISAM;
insert into t1bit7 values (b'110000011111111');
insert into t1bit7 values (b'110000111111111');
insert into t1bit7 values (b'110001011111111');
insert into t2bit7 values (b'110000111111111');
insert into t2bit7 values (b'110001011111111');
insert into t2bit7 values (b'110011011111111');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
bin(a1)
110000111111111
110001011111111
drop table t1bit7, t2bit7;
End of 5.0 tests End of 5.0 tests
create table t1(a bit(7)); create table t1(a bit(7));
insert into t1 values(0x40); insert into t1 values(0x40);
......
...@@ -751,6 +751,19 @@ ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4); ...@@ -751,6 +751,19 @@ ALTER TABLE t1 MODIFY COLUMN v VARCHAR(4);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
#
create table t1 (a tinytext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
drop table t1;
create table t1 (a mediumtext character set latin1);
alter table t1 convert to character set utf8;
show create table t1;
drop table t1;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -367,6 +367,36 @@ CREATE TABLE IF NOT EXISTS t1 ( ...@@ -367,6 +367,36 @@ CREATE TABLE IF NOT EXISTS t1 (
f1 bit(2) NOT NULL default b'' f1 bit(2) NOT NULL default b''
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci; ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
#
# Bug#31399 Wrong query result when doing join buffering over BIT fields
#
create table t1bit7 (a1 bit(7) not null) engine=MyISAM;
create table t2bit7 (b1 bit(7)) engine=MyISAM;
insert into t1bit7 values (b'1100000');
insert into t1bit7 values (b'1100001');
insert into t1bit7 values (b'1100010');
insert into t2bit7 values (b'1100001');
insert into t2bit7 values (b'1100010');
insert into t2bit7 values (b'1100110');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
drop table t1bit7, t2bit7;
create table t1bit7 (a1 bit(15) not null) engine=MyISAM;
create table t2bit7 (b1 bit(15)) engine=MyISAM;
insert into t1bit7 values (b'110000011111111');
insert into t1bit7 values (b'110000111111111');
insert into t1bit7 values (b'110001011111111');
insert into t2bit7 values (b'110000111111111');
insert into t2bit7 values (b'110001011111111');
insert into t2bit7 values (b'110011011111111');
select bin(a1) from t1bit7, t2bit7 where t1bit7.a1=t2bit7.b1;
drop table t1bit7, t2bit7;
--echo End of 5.0 tests --echo End of 5.0 tests
# #
......
...@@ -13856,6 +13856,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -13856,6 +13856,7 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length=0; length=0;
for (i=0 ; i < table_count ; i++) for (i=0 ; i < table_count ; i++)
{ {
bool have_bit_fields= FALSE;
uint null_fields=0,used_fields; uint null_fields=0,used_fields;
Field **f_ptr,*field; Field **f_ptr,*field;
MY_BITMAP *read_set= tables[i].table->read_set; MY_BITMAP *read_set= tables[i].table->read_set;
...@@ -13870,13 +13871,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count) ...@@ -13870,13 +13871,16 @@ join_init_cache(THD *thd,JOIN_TAB *tables,uint table_count)
length+=field->fill_cache_field(copy); length+=field->fill_cache_field(copy);
if (copy->blob_field) if (copy->blob_field)
(*blob_ptr++)=copy; (*blob_ptr++)=copy;
if (field->maybe_null()) if (field->real_maybe_null())
null_fields++; null_fields++;
if (field->type() == MYSQL_TYPE_BIT &&
((Field_bit*)field)->bit_len)
have_bit_fields= TRUE;
copy++; copy++;
} }
} }
/* Copy null bits from table */ /* Copy null bits from table */
if (null_fields && tables[i].table->s->null_fields) if (null_fields || have_bit_fields)
{ /* must copy null bits */ { /* must copy null bits */
copy->str= tables[i].table->null_flags; copy->str= tables[i].table->null_flags;
copy->length= tables[i].table->s->null_bytes; copy->length= tables[i].table->s->null_bytes;
......
...@@ -3111,10 +3111,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field) ...@@ -3111,10 +3111,12 @@ static bool prepare_blob_field(THD *thd, Create_field *sql_field)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_AUTO_CONVERT,
warn_buff); warn_buff);
} }
if ((sql_field->flags & BLOB_FLAG) && sql_field->length) if ((sql_field->flags & BLOB_FLAG) && sql_field->length)
{ {
if (sql_field->sql_type == MYSQL_TYPE_BLOB) if (sql_field->sql_type == FIELD_TYPE_BLOB ||
sql_field->sql_type == FIELD_TYPE_TINY_BLOB ||
sql_field->sql_type == FIELD_TYPE_MEDIUM_BLOB)
{ {
/* The user has given a length to the blob column */ /* The user has given a length to the blob column */
sql_field->sql_type= get_blob_type_from_length(sql_field->length); sql_field->sql_type= get_blob_type_from_length(sql_field->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