Skip to content

Commit e64a3df

Browse files
author
Alexey Botchkov
committed
MDEV-21959 GIS error message doesn't show the wrong value, just the type.
Error message now shows the whole value.
1 parent 89698ce commit e64a3df

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

mysql-test/r/gis.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ NULL
16891689
#
16901690
create table t1 (pt point);
16911691
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
1692-
ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1
1692+
ERROR 22007: Incorrect POINT value: 'POLYGON((1 1,2 2,2 1,1 1))' for column `test`.`t1`.`pt` at row 1
16931693
drop table t1;
16941694
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
16951695
st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100))

mysql-test/suite/innodb/r/innodb-online-alter-gis.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ drop table t1;
4242
#
4343
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
4444
ALTER TABLE t1 ADD COLUMN b LINESTRING DEFAULT POINT(1,1);
45-
ERROR 22007: Incorrect LINESTRING value: 'POINT' for column ``.``.`b` at row 1
45+
ERROR 22007: Incorrect LINESTRING value: 'POINT(1 1)' for column ``.``.`b` at row 1
4646
DESCRIBE t1;
4747
Field Type Null Key Default Extra
4848
a int(11) YES NULL

mysql-test/suite/innodb_gis/r/1.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,9 +1038,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
10381038
SET @a=ST_POLYFROMWKB(@a);
10391039
create table t1(a polygon NOT NULL)engine=InnoDB;
10401040
insert into t1 values (ST_geomfromtext("point(0 1)"));
1041-
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
1041+
ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
10421042
insert into t1 values (ST_geomfromtext("point(1 0)"));
1043-
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
1043+
ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
10441044
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
10451045
p
10461046
drop table t1;

mysql-test/suite/innodb_gis/r/gis.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,9 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000
10341034
SET @a=ST_POLYFROMWKB(@a);
10351035
create table t1(a polygon NOT NULL)engine=innodb;
10361036
insert into t1 values (ST_geomfromtext("point(0 1)"));
1037-
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
1037+
ERROR 22007: Incorrect POLYGON value: 'POINT(0 1)' for column `test`.`t1`.`a` at row 1
10381038
insert into t1 values (ST_geomfromtext("point(1 0)"));
1039-
ERROR 22007: Incorrect POLYGON value: 'POINT' for column `test`.`t1`.`a` at row 1
1039+
ERROR 22007: Incorrect POLYGON value: 'POINT(1 0)' for column `test`.`t1`.`a` at row 1
10401040
select * from (select polygon(t1.a) as p from t1 order by t1.a) d;
10411041
p
10421042
drop table t1;

sql/field.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8841,18 +8841,26 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs)
88418841
{
88428842
const char *db= table->s->db.str;
88438843
const char *tab_name= table->s->table_name.str;
8844+
Geometry_buffer buffer;
8845+
Geometry *geom= NULL;
8846+
String wkt;
8847+
const char *dummy;
88448848

88458849
if (!db)
88468850
db= "";
88478851
if (!tab_name)
88488852
tab_name= "";
8853+
wkt.set_charset(&my_charset_latin1);
8854+
if (!(geom= Geometry::construct(&buffer, from, length)) ||
8855+
geom->as_wkt(&wkt, &dummy))
8856+
goto err;
88498857

88508858
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
88518859
Geometry::ci_collection[geom_type]->m_name.str,
8852-
Geometry::ci_collection[wkb_type]->m_name.str,
8853-
db, tab_name, field_name,
8860+
wkt.c_ptr(), db, tab_name, field_name,
88548861
(ulong) table->in_use->get_stmt_da()->
88558862
current_row_for_warning());
8863+
88568864
goto err_exit;
88578865
}
88588866

0 commit comments

Comments
 (0)