mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #2821 Table default character set affects LONGBLOB fields
This commit is contained in:
@ -343,6 +343,22 @@ t1 CREATE TABLE `t1` (
|
|||||||
`a` char(10) character set latin1 default NULL
|
`a` char(10) character set latin1 default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
|
) ENGINE=MyISAM DEFAULT CHARSET=cp1251
|
||||||
drop table t1;
|
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 (
|
CREATE TABLE t1 (
|
||||||
Host varchar(16) binary NOT NULL default '',
|
Host varchar(16) binary NOT NULL default '',
|
||||||
User varchar(16) binary NOT NULL default '',
|
User varchar(16) binary NOT NULL default '',
|
||||||
|
@ -183,6 +183,17 @@ show create table t1;
|
|||||||
|
|
||||||
drop 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
|
# 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;
|
sql_field->charset= create_info->default_table_charset;
|
||||||
/*
|
/*
|
||||||
table_charset is set in ALTER TABLE if we want change character set
|
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->charset= create_info->table_charset;
|
||||||
sql_field->create_length_to_internal_length();
|
sql_field->create_length_to_internal_length();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user