mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-32456: incorrect result of gis function in view protocol
There are 3 diff in result: 1) NULL value from SELECT Due to incorrect truncating of the hex value, incorrect value is written instead of original value to the view frm. This results in reading incorrect value from frm, so eventual result is NULL. 2) 'Name_exp1' in column name (in gis.test) This was because the identifier in SELECT is longer than 64 characters, so 'Name_exp1' alias is also written to the view frm. 3)diff in explain extended This was because the query plan for view protocol doesn't contain database name. As a fix, disable view protocol for that particular query.
This commit is contained in:
@ -142,11 +142,13 @@ Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
--disable_view_protocol
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o,
|
||||
Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t,
|
||||
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
--enable_view_protocol
|
||||
|
||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
|
||||
|
@ -433,8 +433,8 @@ gc geometrycollection YES NULL
|
||||
gm geometry YES NULL
|
||||
fid int(11) NO NULL
|
||||
DROP TABLE t1;
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) AS val;
|
||||
val
|
||||
POINT(1 4)
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
@ -668,11 +668,11 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert into t1 values (ST_pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))));
|
||||
(ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))))
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) AS val;
|
||||
val
|
||||
POINT(10 10)
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))));
|
||||
(ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))))
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val;
|
||||
val
|
||||
POINT(10 10)
|
||||
create table t1 (g GEOMETRY);
|
||||
select * from t1;
|
||||
|
@ -433,8 +433,8 @@ gc geometrycollection YES NULL
|
||||
gm geometry YES NULL
|
||||
fid int(11) NO NULL
|
||||
DROP TABLE t1;
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))))
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) AS val;
|
||||
val
|
||||
POINT(1 4)
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
@ -668,11 +668,11 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||
insert into t1 values (ST_pointfromtext('point(1,1)'));
|
||||
ERROR 23000: Column 'fl' cannot be null
|
||||
drop table t1;
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))));
|
||||
(ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))))
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) AS val;
|
||||
val
|
||||
POINT(10 10)
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))));
|
||||
(ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))))
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val;
|
||||
val
|
||||
POINT(10 10)
|
||||
create table t1 (g GEOMETRY);
|
||||
select * from t1;
|
||||
|
@ -136,17 +136,20 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
|
||||
--replace_column 10 #
|
||||
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
|
||||
|
||||
--disable_view_protocol
|
||||
SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
|
||||
--replace_column 10 #
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
--enable_view_protocol
|
||||
|
||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
|
||||
@ -169,7 +172,7 @@ ALTER TABLE t1 ADD fid INT NOT NULL;
|
||||
SHOW FIELDS FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) AS val;
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)'))));
|
||||
SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101));
|
||||
@ -398,14 +401,16 @@ insert into t1 values (ST_pointfromtext('point(1,1)'));
|
||||
|
||||
drop table t1;
|
||||
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))));
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))));
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) AS val;
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val;
|
||||
|
||||
--disable_view_protocol
|
||||
--enable_metadata
|
||||
create table t1 (g GEOMETRY);
|
||||
select * from t1;
|
||||
select ST_asbinary(g) from t1;
|
||||
--disable_metadata
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a TEXT, b GEOMETRY NOT NULL, INDEX(b(5)));
|
||||
|
@ -623,17 +623,20 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
|
||||
--replace_column 10 #
|
||||
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
|
||||
|
||||
--disable_view_protocol
|
||||
SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
|
||||
--replace_column 10 #
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
--enable_view_protocol
|
||||
|
||||
--echo # check support of Foreign Key constraint
|
||||
CREATE TABLE parent (id GEOMETRY NOT NULL,PRIMARY KEY (id(10))) ENGINE=INNODB;
|
||||
|
@ -135,17 +135,20 @@ SELECT fid, ST_AsText(ST_GeometryN(g, 1)) from gis_geometrycollection;
|
||||
--replace_column 10 #
|
||||
explain extended SELECT fid, ST_AsText(ST_GeometryN(g, 2)) from gis_multi_point;
|
||||
|
||||
--disable_view_protocol
|
||||
SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
|
||||
--replace_column 10 #
|
||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||
MBRWithin(g1.g, g2.g) as w, MBRContains(g1.g, g2.g) as c, MBROverlaps(g1.g, g2.g) as o,
|
||||
MBREquals(g1.g, g2.g) as e, MBRDisjoint(g1.g, g2.g) as d, ST_Touches(g1.g, g2.g) as t,
|
||||
MBRIntersects(g1.g, g2.g) as i, ST_Crosses(g1.g, g2.g) as r
|
||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||
--enable_view_protocol
|
||||
|
||||
DROP TABLE gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||
|
||||
@ -168,7 +171,7 @@ ALTER TABLE t1 ADD fid INT NOT NULL;
|
||||
SHOW FIELDS FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)')))) AS val;
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_GeometryFromText('POINT(1 4)'))));
|
||||
explain extended SELECT ST_AsText(ST_GeometryFromWKB(ST_AsWKB(ST_PointFromText('POINT(1 4)'))));
|
||||
SELECT ST_SRID(ST_GeomFromText('LineString(1 1,2 2)',101));
|
||||
@ -393,14 +396,16 @@ insert into t1 values (ST_pointfromtext('point(1,1)'));
|
||||
|
||||
drop table t1;
|
||||
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))));
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))));
|
||||
select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000)))) AS val;
|
||||
select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val;
|
||||
|
||||
--disable_view_protocol
|
||||
--enable_metadata
|
||||
create table t1 (g GEOMETRY);
|
||||
select * from t1;
|
||||
select ST_asbinary(g) from t1;
|
||||
--disable_metadata
|
||||
--enable_view_protocol
|
||||
drop table t1;
|
||||
|
||||
create table t1 (a TEXT, b GEOMETRY NOT NULL, SPATIAL KEY(b));
|
||||
|
@ -7278,10 +7278,8 @@ void Item_hex_constant::hex_string_init(THD *thd, const char *str, size_t str_le
|
||||
|
||||
void Item_hex_hybrid::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
uint32 len= MY_MIN(str_value.length(), sizeof(longlong));
|
||||
const char *ptr= str_value.ptr() + str_value.length() - len;
|
||||
str->append("0x");
|
||||
str->append_hex(ptr, len);
|
||||
str->append_hex(str_value.ptr(), str_value.length());
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user