Commit f7022856 authored by unknown's avatar unknown

Bug #2821 Table default character set affects LONGBLOB fields

parent 2f00f000
......@@ -343,6 +343,22 @@ t1 CREATE TABLE `t1` (
`a` char(10) character set latin1 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
drop table t1;
create table t1 (myblob longblob,mytext longtext)
default charset latin1 collate latin1_general_cs;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myblob` longblob,
`mytext` longtext character set latin1 collate latin1_general_cs
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 character set latin2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`myblob` longblob,
`mytext` longtext character set latin2
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t1 (
Host varchar(16) binary NOT NULL default '',
User varchar(16) binary NOT NULL default '',
......
......@@ -183,6 +183,17 @@ show create table t1;
drop table t1;
#
# Bug#2821
# Test that table CHARACTER SET does not affect blobs
#
create table t1 (myblob longblob,mytext longtext)
default charset latin1 collate latin1_general_cs;
show create table t1;
alter table t1 character set latin2;
show create table t1;
drop table t1;
#
# Test ALTER TABLE ENABLE/DISABLE keys when things are locked
#
......
......@@ -470,9 +470,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
sql_field->charset= create_info->default_table_charset;
/*
table_charset is set in ALTER TABLE if we want change character set
for all varchar/char columns
for all varchar/char columns.
But the table charset must not affect the BLOB fields, so don't
allow to change my_charset_bin to somethig else.
*/
if (create_info->table_charset)
if (create_info->table_charset && sql_field->charset != &my_charset_bin)
sql_field->charset= create_info->table_charset;
sql_field->create_length_to_internal_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