summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-03-17 13:11:46 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2020-03-17 13:11:46 +0400
commite64a3df4dc248a8f61f8e2c91fa37ee9bfa5202c (patch)
tree7ad5e99aa97fb558fb0712967171b4227f0e439e
parent89698cef72a5c220a2fcc346e3dd975ae219b7d9 (diff)
downloadmariadb-git-e64a3df4dc248a8f61f8e2c91fa37ee9bfa5202c.tar.gz
MDEV-21959 GIS error message doesn't show the wrong value, just the type.
Error message now shows the whole value.
-rw-r--r--mysql-test/r/gis.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-online-alter-gis.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/1.result4
-rw-r--r--mysql-test/suite/innodb_gis/r/gis.result4
-rw-r--r--sql/field.cc12
5 files changed, 16 insertions, 8 deletions
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 828fbd9d0e7..ecbdd5b586c 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -1689,7 +1689,7 @@ NULL
#
create table t1 (pt point);
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
-ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1
+ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
drop table t1;
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))
diff --git a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
index 423a658283f..5297f1eb4f1 100644
--- a/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
+++ b/mysql-test/suite/innodb/r/innodb-online-alter-gis.result
@@ -42,7 +42,7 @@ drop table t1;
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
-ERROR 22007: Incorrect LINESTRING value: 'POINT' for column ``.``.`b` at row 1
+ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 1
DESCRIBE t1;
Field Type Null Key Default Extra
a int(11) YES NULL
diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result
index 05662d254e0..9a16801ebb5 100644
--- a/mysql-test/suite/innodb_gis/r/1.result
+++ b/mysql-test/suite/innodb_gis/r/1.result
@@ -1038,9 +1038,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=InnoDB;
insert into t1 values (ST_geomfromtext("point(0 1)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result
index a0729cd1150..c0a809a811a 100644
--- a/mysql-test/suite/innodb_gis/r/gis.result
+++ b/mysql-test/suite/innodb_gis/r/gis.result
@@ -1034,9 +1034,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
SET @a=ST_POLYFROMWKB(@a);
create table t1(a polygon NOT NULL)engine=innodb;
insert into t1 values (ST_geomfromtext("point(0 1)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
insert into t1 values (ST_geomfromtext("point(1 0)"));
-ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
+ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
p
drop table t1;
diff --git a/sql/field.cc b/sql/field.cc
index 09e82acb009..857ba8d0e0c 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8841,18 +8841,26 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
{
const char *db= table->s->db.str;
const char *tab_name= table->s->table_name.str;
+ Geometry_buffer buffer;
+ Geometry *geom= NULL;
+ String wkt;
+ const char *dummy;
if (!db)
db= "";
if (!tab_name)
tab_name= "";
+ wkt.set_charset(&my_charset_latin1);
+ if (!(geom= Geometry::construct(&buffer, from, length)) ||
+ geom->as_wkt(&wkt, &dummy))
+ goto err;
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[geom_type]->m_name.str,
- Geometry::ci_collection[wkb_type]->m_name.str,
- db, tab_name, field_name,
+ wkt.c_ptr(), db, tab_name, field_name,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
+
goto err_exit;
}