summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-10-26 00:56:17 +0400
committerunknown <sergefp@mysql.com>2005-10-26 00:56:17 +0400
commit115bf43602424f2bba326efab6d7ec51c66ac4e5 (patch)
tree574ae35505c263717f483ef3e77b930a931f5de5 /sql/field.h
parent1c9783e854965376844a021ab1312b373852f287 (diff)
downloadmariadb-git-115bf43602424f2bba326efab6d7ec51c66ac4e5.tar.gz
BUG#14139: When handling "CREATE TABLE(field_X type_spec,...) SELECT smth AS field_X, ...."
avoid multiplying length of field_X by charset->mbmaxlen twice when calculating space required for field_X in the new table. mysql-test/r/create.result: Testcase for BUG#14139 mysql-test/t/create.test: Testcase for BUG#14139 sql/field.cc: BUG#14139: Make create_length_to_internal_length() save length-in-characters in create_field::chars_length. sql/field.h: BUG#14139: Add create_length::chars_length where we save length-in-characters, added comments. sql/sql_table.cc: BUG#14139: When handling "CREATE TABLE(field_X type_spec,...) SELECT smth AS field_X, ...." we get two instances of create_field: (1) is occurence of field_X in create list, and (2) is in select list. If we figure they both refer to the same field, we "join" them according to some rule that is not explicitly specified anywhere. When we do this "join", create_field::length already contains length-in-bytes for both, so when we transfer field length (in characters) from (1) to (2), use length-in-characters that we have saved in create_length::chars_length.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h
index ba963418c7a..04f1bd68c7a 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1180,7 +1180,15 @@ public:
LEX_STRING comment; // Comment for field
Item *def; // Default value
enum enum_field_types sql_type;
+ /*
+ At various stages in execution this can be length of field in bytes or
+ max number of characters.
+ */
uint32 length;
+ /*
+ The value of 'length' before a call to create_length_to_internal_length
+ */
+ uint32 chars_length;
uint decimals,flags,pack_length;
Field::utype unireg_check;
TYPELIB *interval; // Which interval to use