From 374252c6860bfeab1efcd44078c0e203d21d676d Mon Sep 17 00:00:00 2001
From: unknown <monty@mysql.com>
Date: Thu, 2 Dec 2004 15:14:01 +0200
Subject: [PATCH] merge (new code fixed the ALTER TABLE problem)

---
 sql/field.cc     | 23 -----------------------
 sql/mysql_priv.h |  2 --
 2 files changed, 25 deletions(-)

diff --git a/sql/field.cc b/sql/field.cc
index b9c9b26907..90203d1935 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5853,33 +5853,10 @@ void create_field::create_length_to_internal_length(void)
     pack_length= calc_pack_length(sql_type == FIELD_TYPE_VAR_STRING ?
                                   FIELD_TYPE_STRING : sql_type, length);
     break;
-#ifdef CORRECT_CODE_BUT_CANT_YET_BE_USED
   case MYSQL_TYPE_ENUM:
   case MYSQL_TYPE_SET:
     length*= charset->mbmaxlen;
     break;
-#else
-    /*
-      Because of a bug in MySQL 4.1 where length was extended for ENUM and SET
-      fields for every ALTER TABLE, we have to recalculate lengths here
-    */
-  case MYSQL_TYPE_ENUM:
-  {
-    uint32 tot_length, max_length;
-    calculate_interval_lengths(current_thd, interval,
-                               &max_length, &tot_length);
-    length= max_length * charset->mbmaxlen;
-    break;
-  }
-  case MYSQL_TYPE_SET:
-  {
-    uint32 tot_length, max_length;
-    calculate_interval_lengths(current_thd, interval,
-                               &max_length, &tot_length);
-    length= (tot_length + (interval->count - 1)) * charset->mbmaxlen;
-    break;
-  }
-#endif
   default:
     /* do nothing */
     break;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index b4f19a54de..3a19a903e0 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -370,8 +370,6 @@ int insert_precheck(THD *thd, TABLE_LIST *tables);
 int create_table_precheck(THD *thd, TABLE_LIST *tables,
 			  TABLE_LIST *create_table);
 Item *negate_expression(THD *thd, Item *expr);
-void calculate_interval_lengths(THD *thd, TYPELIB *interval,
-                                uint *max_length, uint *tot_length);
 #include "sql_class.h"
 #include "opt_range.h"
 
-- 
2.30.9