Skip to content

Commit b32d05c

Browse files
Merge branch 'mysql-5.5' into mysql-5.6
2 parents 11c684f + 1ec594d commit b32d05c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

sql/sql_table.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3640,8 +3640,31 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
36403640
else
36413641
{
36423642
/* Field redefined */
3643+
3644+
/*
3645+
If we are replacing a BIT field, revert the increment
3646+
of total_uneven_bit_length that was done above.
3647+
*/
3648+
if (sql_field->sql_type == MYSQL_TYPE_BIT &&
3649+
file->ha_table_flags() & HA_CAN_BIT_FIELD)
3650+
total_uneven_bit_length-= sql_field->length & 7;
3651+
36433652
sql_field->def= dup_field->def;
36443653
sql_field->sql_type= dup_field->sql_type;
3654+
3655+
/*
3656+
If we are replacing a field with a BIT field, we need
3657+
to initialize pack_flag. Note that we do not need to
3658+
increment total_uneven_bit_length here as this dup_field
3659+
has already been processed.
3660+
*/
3661+
if (sql_field->sql_type == MYSQL_TYPE_BIT)
3662+
{
3663+
sql_field->pack_flag= FIELDFLAG_NUMBER;
3664+
if (!(file->ha_table_flags() & HA_CAN_BIT_FIELD))
3665+
sql_field->pack_flag|= FIELDFLAG_TREAT_BIT_AS_CHAR;
3666+
}
3667+
36453668
sql_field->charset= (dup_field->charset ?
36463669
dup_field->charset :
36473670
create_info->default_table_charset);

0 commit comments

Comments
 (0)