summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-08-18 11:27:00 +0300
committerMonty <monty@mariadb.org>2015-08-18 11:27:00 +0300
commit4374da63f03abc472f68f42e4e93261a18bfe417 (patch)
tree4e6ee59be4da4839e8915532b26c0144138e156a /sql/field.cc
parent5fe8b747e9e3440f2f746accca0eb11e287a6713 (diff)
parentdfac82e44dd665ab218348765df2b519db4c10dc (diff)
downloadmariadb-git-4374da63f03abc472f68f42e4e93261a18bfe417.tar.gz
Merge /my/maria-10.1-default into 10.1
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 6ca0d4a7d63..5d45a8d39d1 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -9463,14 +9463,6 @@ bool Create_field::check(THD *thd)
sql_type= vcol_info->get_real_type();
}
- /*
- Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
- it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
- */
- if (!def && unireg_check == Field::NONE &&
- (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type))
- flags|= NO_DEFAULT_VALUE_FLAG;
-
sign_len= flags & UNSIGNED_FLAG ? 0 : 1;
switch (sql_type) {
@@ -9663,6 +9655,16 @@ bool Create_field::check(THD *thd)
/* Remember the value of length */
char_length= length;
+ /*
+ Set NO_DEFAULT_VALUE_FLAG if this field doesn't have a default value and
+ it is NOT NULL, not an AUTO_INCREMENT field and not a TIMESTAMP.
+ We need to do this check here and in mysql_create_prepare_table() as
+ sp_head::fill_field_definition() calls this function.
+ */
+ if (!def && unireg_check == Field::NONE &&
+ (flags & NOT_NULL_FLAG) && !is_timestamp_type(sql_type))
+ flags|= NO_DEFAULT_VALUE_FLAG;
+
if (!(flags & BLOB_FLAG) &&
((length > max_field_charlength &&
(sql_type != MYSQL_TYPE_VARCHAR || def)) ||