From 7caa80c48170f8a35ef8ece7a1881fe1f0e022dd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 20 Jan 2013 14:06:33 +0100 Subject: [PATCH] MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column sel_arg_range_seq_next(): set keypart map also for GEOM_FLAG keys --- mysql-test/r/gis2.result | 14 ++++++++++++++ mysql-test/t/gis2.test | 17 +++++++++++++++++ sql/opt_range_mrr.cc | 1 + 3 files changed, 32 insertions(+) create mode 100644 mysql-test/r/gis2.result create mode 100644 mysql-test/t/gis2.test diff --git a/mysql-test/r/gis2.result b/mysql-test/r/gis2.result new file mode 100644 index 00000000000..214431e1d2d --- /dev/null +++ b/mysql-test/r/gis2.result @@ -0,0 +1,14 @@ +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +point_data POINT NOT NULL, +PRIMARY KEY (id), +KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES +(GeomFromText('Point(37.0248492 23.8512726)')), +(GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +id +2 +DROP TABLE t1; diff --git a/mysql-test/t/gis2.test b/mysql-test/t/gis2.test new file mode 100644 index 00000000000..b734ab19ecd --- /dev/null +++ b/mysql-test/t/gis2.test @@ -0,0 +1,17 @@ +# +# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column +# + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + point_data POINT NOT NULL, + PRIMARY KEY (id), + KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES + (GeomFromText('Point(37.0248492 23.8512726)')), + (GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +DROP TABLE t1; + diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index a4345059f85..1f4e36178db 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -248,6 +248,7 @@ walk_up_n_right: /* Here minimum contains also function code bits, and maximum is +inf */ range->start_key.key= seq->param->min_key; range->start_key.length= min_key_length; + range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts); range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG); } else