From a22bc99ff6467f2804c01600465785125a1b1ff2 Mon Sep 17 00:00:00 2001 From: Mats Kindahl Date: Mon, 21 Dec 2009 19:50:25 +0100 Subject: [PATCH] WL#5151: Conversion between different types when replicating Bug#49836 reports that the geometry type does not work with WL#5151 applied. The GEOMETRY type inherits the blob comparison function, which read the pack length from the metadata. The GEOMETRY type does not fill in the metadata with anything sensible, so it is always zero, meaning that the pack length for the source type is considered zero, rendering it always "smaller" than the target type which has pack length 4 (without pointer). This patch fixes the problem by defining Field_geom::pack_length_from_metadata() to always use the same as Field_geom::row_pack_length(). --- mysql-test/extra/rpl_tests/type_conversions.test | 7 +++++++ mysql-test/suite/rpl/r/rpl_typeconv.result | 4 ++++ sql/field.h | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/mysql-test/extra/rpl_tests/type_conversions.test b/mysql-test/extra/rpl_tests/type_conversions.test index 6e52da59201..791e07c4822 100644 --- a/mysql-test/extra/rpl_tests/type_conversions.test +++ b/mysql-test/extra/rpl_tests/type_conversions.test @@ -12,6 +12,13 @@ connection slave; let $if_is_lossy = `SELECT FIND_IN_SET('ALL_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; let $if_is_non_lossy = `SELECT FIND_IN_SET('ALL_NON_LOSSY', @@SLAVE_TYPE_CONVERSIONS)`; +let $source_type = GEOMETRY; +let $target_type = GEOMETRY; +let $source_value = PointFromText('POINT(10 10)'); +let $target_value = PointFromText('POINT(10 10)'); +let $can_convert = 1; +source extra/rpl_tests/check_type.inc; + let $source_type = BIT(1); let $target_type = BIT(1); let $source_value = b'1'; diff --git a/mysql-test/suite/rpl/r/rpl_typeconv.result b/mysql-test/suite/rpl/r/rpl_typeconv.result index 90451759406..34ec81973ae 100644 --- a/mysql-test/suite/rpl/r/rpl_typeconv.result +++ b/mysql-test/suite/rpl/r/rpl_typeconv.result @@ -69,6 +69,7 @@ RESET MASTER; include/start_slave.inc **** Result of conversions **** Source_Type Target_Type All_Type_Conversion_Flags Value_On_Slave +GEOMETRY GEOMETRY BIT(1) BIT(1) DATE DATE ENUM('master',' ENUM('master',' @@ -171,6 +172,7 @@ BIT(5) BIT(6) BIT(6) BIT(5) BIT(5) BIT(12) BIT(12) BIT(5) +GEOMETRY GEOMETRY ALL_NON_LOSSY BIT(1) BIT(1) ALL_NON_LOSSY DATE DATE ALL_NON_LOSSY ENUM('master',' ENUM('master',' ALL_NON_LOSSY @@ -273,6 +275,7 @@ BIT(5) BIT(6) ALL_NON_LOSSY BIT(6) BIT(5) ALL_NON_LOSSY BIT(5) BIT(12) ALL_NON_LOSSY BIT(12) BIT(5) ALL_NON_LOSSY +GEOMETRY GEOMETRY ALL_LOSSY BIT(1) BIT(1) ALL_LOSSY DATE DATE ALL_LOSSY ENUM('master',' ENUM('master',' ALL_LOSSY @@ -375,6 +378,7 @@ BIT(5) BIT(6) ALL_LOSSY BIT(6) BIT(5) ALL_LOSSY BIT(5) BIT(12) ALL_LOSSY BIT(12) BIT(5) ALL_LOSSY +GEOMETRY GEOMETRY ALL_LOSSY,ALL_NON_LOSSY BIT(1) BIT(1) ALL_LOSSY,ALL_NON_LOSSY DATE DATE ALL_LOSSY,ALL_NON_LOSSY ENUM('master',' ENUM('master',' ALL_LOSSY,ALL_NON_LOSSY diff --git a/sql/field.h b/sql/field.h index 12ee9b46d03..c6c6f04d925 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1817,6 +1817,10 @@ public: uint size_of() const { return sizeof(*this); } int reset(void) { return !maybe_null() || Field_blob::reset(); } geometry_type get_geometry_type() { return geom_type; }; + uint pack_length_from_metadata(uint field_metadata) + { + return pack_length_no_ptr(); + } }; #endif /*HAVE_SPATIAL*/