summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorkostja@bodhi.local <>2006-08-30 00:45:33 +0400
committerkostja@bodhi.local <>2006-08-30 00:45:33 +0400
commitf8d34e10300ccf987bc8461a9581a7d5cfadcb29 (patch)
tree55ee75a4f6e2dfc6ac630c5e0f0e66445bae20fb /sql/field.cc
parent4761ea5c82d9b843aba9ee1fb0a889a1237e6fbd (diff)
parent3bf609b7f2b73555b1e241dc7c354818b0bbbc5a (diff)
downloadmariadb-git-f8d34e10300ccf987bc8461a9581a7d5cfadcb29.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into bodhi.local:/opt/local/work/mysql-5.0-14897
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 4fea6a085bb..4860f6ea3da 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -6154,15 +6154,26 @@ Field *Field_string::new_field(MEM_ROOT *root, struct st_table *new_table,
Field *new_field;
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
- return Field::new_field(root, new_table, keep_type);
+ new_field= Field::new_field(root, new_table, keep_type);
+ else
+ {
- /*
- Old VARCHAR field which should be modified to a VARCHAR on copy
- This is done to ensure that ALTER TABLE will convert old VARCHAR fields
- to now VARCHAR fields.
- */
- return new Field_varstring(field_length, maybe_null(),
- field_name, new_table, charset());
+ /*
+ Old VARCHAR field which should be modified to a VARCHAR on copy
+ This is done to ensure that ALTER TABLE will convert old VARCHAR fields
+ to now VARCHAR fields.
+ */
+ new_field= new Field_varstring(field_length, maybe_null(),
+ field_name, new_table, charset());
+ /*
+ Normally orig_table is different from table only if field was created
+ via ::new_field. Here we alter the type of field, so ::new_field is
+ not applicable. But we still need to preserve the original field
+ metadata for the client-server protocol.
+ */
+ new_field->orig_table= orig_table;
+ }
+ return new_field;
}
/****************************************************************************