From: Tor Didriksen Date: July 4 2011 12:23pm Subject: bzr push into mysql-trunk branch (tor.didriksen:3196 to 3197) List-Archive: http://lists.mysql.com/commits/140174 Message-Id: <201107041223.p64CNXna000561@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3197 Tor Didriksen 2011-07-04 [merge] Merge 5.5 => trunk modified: mysql-test/r/gis.result mysql-test/t/gis.test sql/field.h sql/field_conv.cc 3196 Jon Olav Hauglid 2011-07-04 [merge] Merge from mysql-5.5 to mysql-trunk. modified: mysql-test/include/mtr_check.sql mysql-test/include/mtr_warnings.sql === modified file 'mysql-test/r/gis.result' --- a/mysql-test/r/gis.result 2011-05-10 13:37:37 +0000 +++ b/mysql-test/r/gis.result 2011-07-04 12:22:37 +0000 @@ -1076,6 +1076,21 @@ SPATIAL INDEX i1 (col1, col2) ); ERROR HY000: Incorrect arguments to SPATIAL INDEX DROP TABLE t0, t1, t2; +# +# Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +# +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam; +INSERT INTO g1 VALUES (geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (geomfromtext('point(1 2)')); +FLUSH TABLES; +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; +1 +Warnings: +Warning 1441 Datetime function: datetime field overflow +DROP TABLE g1; End of 5.5 tests DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; === modified file 'mysql-test/t/gis.test' --- a/mysql-test/t/gis.test 2011-05-10 13:37:37 +0000 +++ b/mysql-test/t/gis.test 2011-07-04 12:22:37 +0000 @@ -820,6 +820,24 @@ CREATE TABLE t3 ( # cleanup DROP TABLE t0, t1, t2; +--echo # +--echo # Bug#11908153: CRASH AND/OR VALGRIND ERRORS IN FIELD_BLOB::GET_KEY_IMAGE +--echo # + +CREATE TABLE g1 +(a geometry NOT NULL, UNIQUE KEY i (a(151))) engine=myisam; + +INSERT INTO g1 VALUES (geomfromtext('point(1 1)')); +INSERT INTO g1 VALUES (geomfromtext('point(1 2)')); + +FLUSH TABLES; + +SELECT 1 FROM g1 +FORCE INDEX(i) WHERE a = date_sub(now(), interval 2808.4 year_month) +; + +DROP TABLE g1; + --echo End of 5.5 tests === modified file 'sql/field.h' --- a/sql/field.h 2011-07-04 00:25:46 +0000 +++ b/sql/field.h 2011-07-04 12:22:37 +0000 @@ -2087,7 +2087,13 @@ public: int store(double nr); int store(longlong nr, bool unsigned_val); int store_decimal(const my_decimal *); - int reset(void) { return !maybe_null() || Field_blob::reset(); } + + /** + Non-nullable GEOMETRY types cannot have defaults, + but the underlying blob must still be reset. + */ + int reset(void) { return Field_blob::reset() || !maybe_null(); } + geometry_type get_geometry_type() { return geom_type; }; Field_geom *clone(MEM_ROOT *mem_root) const { DBUG_ASSERT(type() == MYSQL_TYPE_GEOMETRY); === modified file 'sql/field_conv.cc' --- a/sql/field_conv.cc 2011-07-04 00:25:46 +0000 +++ b/sql/field_conv.cc 2011-07-04 12:22:37 +0000 @@ -178,7 +178,10 @@ set_field_to_null_with_conversions(Field ((Field_timestamp*) field)->set_time(); return 0; // Ok to set time to NULL } + + // Note: we ignore any potential failure of reset() here. field->reset(); + if (field == field->table->next_number_field) { field->table->auto_increment_field_not_null= FALSE; No bundle (reason: useless for push emails).