diff options
author | Georgi Kodinov <joro@sun.com> | 2009-10-21 11:43:45 +0300 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2009-10-21 11:43:45 +0300 |
commit | 19ffe2308542735bc37e070bbdf266281ea8156a (patch) | |
tree | 4736457765d2b9e443a04853d31af50aa2f2d633 /mysql-test | |
parent | b7ce2a01bc7cdf7984cbd12848f7f61c2f582a89 (diff) | |
download | mariadb-git-19ffe2308542735bc37e070bbdf266281ea8156a.tar.gz |
Bug #47780: crash when comparing GIS items from subquery
If the first argument to GeomFromWKB function is a geometry
field then the function just returns its value.
However in doing so it's not preserving first argument's
null_value flag and this causes unexpected null value to
be returned to the calling function.
Fixed by updating the null_value of the GeomFromWKB function
in such cases (and all other cases that return a NULL e.g.
because of not enough memory for the return buffer).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/gis.result | 12 | ||||
-rw-r--r-- | mysql-test/t/gis.test | 16 |
2 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index 5b7a58add06..140c133d75f 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -971,4 +971,16 @@ select min(`col002`) from t1 union select `col002` from t1; min(`col002`) NULL drop table t1; +# +# Bug #47780: crash when comparing GIS items from subquery +# +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES +(0, +GEOMFROMTEXT( +'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); +# must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); +1 +DROP TABLE t1; End of 5.0 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index c01fa205349..701a6cef6be 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -654,4 +654,20 @@ insert into t1 values (),(),(); select min(`col002`) from t1 union select `col002` from t1; drop table t1; +--echo # +--echo # Bug #47780: crash when comparing GIS items from subquery +--echo # + +CREATE TABLE t1(a INT, b MULTIPOLYGON); +INSERT INTO t1 VALUES + (0, + GEOMFROMTEXT( + 'multipolygon(((1 2,3 4,5 6,7 8,9 8),(7 6,5 4,3 2,1 2,3 4)))')); + +--echo # must not crash +SELECT 1 FROM t1 WHERE a <> (SELECT GEOMETRYCOLLECTIONFROMWKB(b) FROM t1); + +DROP TABLE t1; + + --echo End of 5.0 tests |