summaryrefslogtreecommitdiff
path: root/sql/rpl_utility.cc
diff options
context:
space:
mode:
authorGalina Shalygina <galina.shalygina@mariadb.com>2018-06-01 21:57:10 +0200
committerGalina Shalygina <galina.shalygina@mariadb.com>2018-06-01 21:57:10 +0200
commit6db465d7ce455cf75ec224108cbe61ca8be63d3d (patch)
tree9648ff1fc677eebb60b278c2e2c13131934ed2a0 /sql/rpl_utility.cc
parentffe83e8e7bef32eb2a80aad2d382f0b023dd3a44 (diff)
parent4a49f7f88cfa82ae6eb8e7b5a528e91416b33b52 (diff)
downloadmariadb-git-shagalla-10.4.tar.gz
Merge 10.3.7 into 10.4shagalla-10.4
Diffstat (limited to 'sql/rpl_utility.cc')
-rw-r--r--sql/rpl_utility.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc
index 58711078db6..31035fb5dcc 100644
--- a/sql/rpl_utility.cc
+++ b/sql/rpl_utility.cc
@@ -42,6 +42,12 @@ max_display_length_for_temporal2_field(uint32 int_display_length,
@param sql_type Type of the field
@param metadata The metadata from the master for the field.
@return Maximum length of the field in bytes.
+
+ The precise values calculated by field->max_display_length() and
+ calculated by max_display_length_for_field() can differ (by +1 or -1)
+ for integer data types (TINYINT, SMALLINT, MEDIUMINT, INT, BIGINT).
+ This slight difference is not important here, because we call
+ this function only for two *different* integer data types.
*/
static uint32
max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
@@ -737,6 +743,16 @@ can_convert_field_to(Field *field,
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
+ /*
+ max_display_length_for_field() is not fully precise for the integer
+ data types. So its result cannot be compared to the result of
+ field->max_dispay_length() when the table field and the binlog field
+ are of the same type.
+ This code should eventually be rewritten not to use
+ compare_lengths(), to detect subtype/supetype relations
+ just using the type codes.
+ */
+ DBUG_ASSERT(source_type != field->real_type());
*order_var= compare_lengths(field, source_type, metadata);
DBUG_ASSERT(*order_var != 0);
DBUG_RETURN(is_conversion_ok(*order_var, rli));