Commit 301582c1 authored by unknown's avatar unknown

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.1

into gluh.mysql.r18.ru:/home/gluh/MySQL-BUGS/mysql-4.1.6840

parents 31099d11 9f48eedb
...@@ -1737,3 +1737,11 @@ def test t1 t1 c c 254 3 0 Y 384 0 8 ...@@ -1737,3 +1737,11 @@ def test t1 t1 c c 254 3 0 Y 384 0 8
a b c a b c
Y NULL NULL Y NULL NULL
drop table t1; drop table t1;
create table t1 (a enum('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;
create table t1 (a set('x','y') default 'x');
alter table t1 alter a set default 'z';
ERROR 42000: Invalid default value for 'a'
drop table t1;
...@@ -111,5 +111,18 @@ alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin; ...@@ -111,5 +111,18 @@ alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin; alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
--enable_metadata --enable_metadata
select * from t1; select * from t1;
--disable metadata --disable_metadata
drop table t1;
#
# Bug #6840 Default value is not checked in ALTER column SET DEFAULT 'x'
#
create table t1 (a enum('x','y') default 'x');
--error 1067
alter table t1 alter a set default 'z';
drop table t1;
create table t1 (a set('x','y') default 'x');
--error 1067
alter table t1 alter a set default 'z';
drop table t1; drop table t1;
...@@ -485,25 +485,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -485,25 +485,27 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
if ((sql_field->sql_type == FIELD_TYPE_SET || if (sql_field->sql_type == FIELD_TYPE_SET ||
sql_field->sql_type == FIELD_TYPE_ENUM) && !sql_field->interval) sql_field->sql_type == FIELD_TYPE_ENUM)
{ {
uint32 dummy; uint32 dummy;
CHARSET_INFO *cs= sql_field->charset; CHARSET_INFO *cs= sql_field->charset;
TYPELIB *interval; TYPELIB *interval= sql_field->interval;
/* /*
Create typelib from interval_list, and if necessary Create typelib from interval_list, and if necessary
convert strings from client character set to the convert strings from client character set to the
column character set. column character set.
*/ */
if (!interval)
{
interval= sql_field->interval= typelib(sql_field->interval_list); interval= sql_field->interval= typelib(sql_field->interval_list);
List_iterator<String> it(sql_field->interval_list); List_iterator<String> it(sql_field->interval_list);
String conv, *tmp; String conv, *tmp;
for (uint i= 0; (tmp= it++); i++) for (uint i= 0; (tmp= it++); i++)
{ {
if (String::needs_conversion(tmp->length(), tmp->charset(), cs, &dummy)) if (String::needs_conversion(tmp->length(), tmp->charset(),
cs, &dummy))
{ {
uint cnv_errs; uint cnv_errs;
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs); conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
...@@ -521,7 +523,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -521,7 +523,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
((uchar *)interval->type_names[i])[lengthsp]= '\0'; ((uchar *)interval->type_names[i])[lengthsp]= '\0';
} }
sql_field->interval_list.empty(); // Don't need interval_list anymore sql_field->interval_list.empty(); // Don't need interval_list anymore
}
/* /*
Convert the default value from client character Convert the default value from client character
......
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