mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 05:52:27 +01:00
Merge mysql.com:/usr/home/bar/mysql-4.1.b20471v2
into mysql.com:/usr/home/bar/mysql-4.1-kt
This commit is contained in:
commit
c2fa031b99
4 changed files with 48 additions and 1 deletions
|
@ -1745,3 +1745,12 @@ 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;
|
||||
create table t1 (f1 int);
|
||||
alter table t1 add f2 enum(0xFFFF);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) default NULL,
|
||||
`f2` enum('ÿÿ') default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
|
|
@ -127,4 +127,13 @@ create table t1 (a set('x','y') default 'x');
|
|||
alter table t1 alter a set default 'z';
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug#20922 mysql removes a name of first column in a table
|
||||
#
|
||||
create table t1 (f1 int);
|
||||
alter table t1 add f2 enum(0xFFFF);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
|
16
sql/table.cc
16
sql/table.cc
|
@ -387,7 +387,21 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
|
|||
count)))
|
||||
goto err_not_open;
|
||||
for (count= 0; count < interval->count; count++)
|
||||
interval->type_lengths[count]= strlen(interval->type_names[count]);
|
||||
{
|
||||
char *val= (char*) interval->type_names[count];
|
||||
interval->type_lengths[count]= strlen(val);
|
||||
/*
|
||||
Replace all ',' symbols with NAMES_SEP_CHAR.
|
||||
See the comment in unireg.cc, pack_fields() function
|
||||
for details.
|
||||
*/
|
||||
for (uint cnt= 0 ; cnt < interval->type_lengths[count] ; cnt++)
|
||||
{
|
||||
char c= val[cnt];
|
||||
if (c == ',')
|
||||
val[cnt]= NAMES_SEP_CHAR;
|
||||
}
|
||||
}
|
||||
interval->type_lengths[count]= 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,6 +637,21 @@ static bool pack_fields(File file, List<create_field> &create_fields,
|
|||
tmp.append(NAMES_SEP_CHAR);
|
||||
for (const char **pos=field->interval->type_names ; *pos ; pos++)
|
||||
{
|
||||
char *val= (char*) *pos;
|
||||
uint str_len= strlen(val);
|
||||
/*
|
||||
Note, hack: in old frm NAMES_SEP_CHAR is used to separate
|
||||
names in the interval (ENUM/SET). To allow names to contain
|
||||
NAMES_SEP_CHAR, we replace it with a comma before writing frm.
|
||||
Backward conversion is done during frm file opening,
|
||||
See table.cc, openfrm() function
|
||||
*/
|
||||
for (uint cnt= 0 ; cnt < str_len ; cnt++)
|
||||
{
|
||||
char c= val[cnt];
|
||||
if (c == NAMES_SEP_CHAR)
|
||||
val[cnt]= ',';
|
||||
}
|
||||
tmp.append(*pos);
|
||||
tmp.append(NAMES_SEP_CHAR);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue