Commit e64a3df4 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-21959 GIS error message doesn't show the wrong value, just the type.

Error message now shows the whole value.
parent 89698cef
......@@ -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))
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment