diff options
author | Monty <monty@mariadb.org> | 2017-12-22 14:34:41 +0200 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2017-12-22 14:56:58 +0200 |
commit | 5b4c8469d5e1988f6f7408fa6c7cc54f9bb1f290 (patch) | |
tree | ea9a80136032795037043cc6dd83a07e6c2eaaf4 /sql/field_conv.cc | |
parent | 139e8afc2c165a08f4fa13da70b0aad3cf7b9df5 (diff) | |
download | mariadb-git-5b4c8469d5e1988f6f7408fa6c7cc54f9bb1f290.tar.gz |
Added CHECK_FIELD_EXPRESSION
This is needed for MDEV 13679 Enabled sequences to be used in DEFAULT
Added new option for count_cuted_fields: CHECK_FIELD_EXPRESSION
which is used to check if a DEFAULT expression is correct before
ALTER TABLE starts
Changed also all test:
if (thd->count_cuted_fields)
to
if (thd->count_cuted_fields > CHECK_FIELD_EXPRESSION)
Diffstat (limited to 'sql/field_conv.cc')
-rw-r--r-- | sql/field_conv.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sql/field_conv.cc b/sql/field_conv.cc index a817db51569..db5c9429954 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -122,6 +122,7 @@ static int set_bad_null_error(Field *field, int err) field->set_warning(Sql_condition::WARN_LEVEL_WARN, err, 1); /* fall through */ case CHECK_FIELD_IGNORE: + case CHECK_FIELD_EXPRESSION: return 0; case CHECK_FIELD_ERROR_FOR_NULL: if (!field->table->in_use->no_errors) @@ -528,7 +529,8 @@ static void do_varstring1(Copy_field *copy) if (length > copy->to_length- 1) { length=copy->to_length - 1; - if (copy->from_field->table->in_use->count_cuted_fields && + if (copy->from_field->table->in_use->count_cuted_fields > + CHECK_FIELD_EXPRESSION && copy->to_field) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); @@ -547,7 +549,7 @@ static void do_varstring1_mb(Copy_field *copy) Well_formed_prefix prefix(cs, (char*) from_ptr, from_length, to_char_length); if (prefix.length() < from_length) { - if (current_thd->count_cuted_fields) + if (current_thd->count_cuted_fields > CHECK_FIELD_EXPRESSION) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } @@ -562,7 +564,8 @@ static void do_varstring2(Copy_field *copy) if (length > copy->to_length- HA_KEY_BLOB_LENGTH) { length=copy->to_length-HA_KEY_BLOB_LENGTH; - if (copy->from_field->table->in_use->count_cuted_fields && + if (copy->from_field->table->in_use->count_cuted_fields > + CHECK_FIELD_EXPRESSION && copy->to_field) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); @@ -582,7 +585,7 @@ static void do_varstring2_mb(Copy_field *copy) Well_formed_prefix prefix(cs, (char*) from_beg, from_length, char_length); if (prefix.length() < from_length) { - if (current_thd->count_cuted_fields) + if (current_thd->count_cuted_fields > CHECK_FIELD_EXPRESSION) copy->to_field->set_warning(Sql_condition::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); } |