From 4aeded63fdf9b627d07c50609becffbbc3aeecc3 Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Fri, 5 Aug 2005 20:19:51 +0500 Subject: [PATCH 1/2] Fix for bug #12281 (Geometry: crash in trigger) Field_geom lack size_of method --- sql/field.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/field.h b/sql/field.h index 523cf444c30..2b67ed3f599 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1204,6 +1204,7 @@ public: int store(longlong nr); int store_decimal(const my_decimal *); void get_key_image(char *buff,uint length,imagetype type); + uint size_of() const { return sizeof(*this); } }; #endif /*HAVE_SPATIAL*/ From 56b91a8c15ab03aeb7b1740212b1f11577605bbb Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Fri, 5 Aug 2005 20:26:55 +0500 Subject: [PATCH 2/2] testcase added to fix for bug #12281 (Geometry & trigger crash) --- mysql-test/r/gis.result | 5 +++++ mysql-test/t/gis.test | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 93216fe2003..dfe375fd694 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -665,3 +665,8 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (pointfromtext('point(1,1)')); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +insert into t1 values (null,null); +ERROR 23000: Column 's1' cannot be null +drop table t1; diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 661616c0a6c..202042d0257 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -373,3 +373,13 @@ insert into t1 values (pointfromtext('point(1,1)')); drop table t1; # End of 4.1 tests + +# +# Bug #12281 (Geometry: crash in trigger) +# + +create table t1 (s1 geometry not null,s2 char(100)); +create trigger t1_bu before update on t1 for each row set new.s1 = null; +--error 1048 +insert into t1 values (null,null); +drop table t1;