Skip to content

Commit 187b796

Browse files
committed
Bug#22306745 ST_BUFFER DOES NOT WORK FOR NON CARTESIAN COORDINATES IN
MYSQL V5.7 Problem: ST_Buffer returns an error message when passed a geometry with SRID different from 0. Fix: Allow geometries with SRID != 0. All calculations will still be Cartesian since the server doesn't support non-Cartesian spatial reference systems.
1 parent 3694eb1 commit 187b796

File tree

7 files changed

+7
-13
lines changed

7 files changed

+7
-13
lines changed

mysql-test/r/gis.result

+2-1
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,8 @@ MULTIPOLYGON(((52 18,48 6,73 9,66 23,52 18),(59 18,67 18,67 13,59 13,59 18)),((6
15191519
SELECT count(*)
15201520
FROM buildings, bridges
15211521
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
1522-
ERROR HY000: Incorrect arguments to st_buffer
1522+
count(*)
1523+
1
15231524
DROP DATABASE gis_ogs;
15241525
#
15251526
# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1510,7 +1510,8 @@ MULTIPOLYGON(((52 18,48 6,73 9,66 23,52 18),(59 18,67 18,67 13,59 13,59 18)),((6
15101510
SELECT count(*)
15111511
FROM buildings, bridges
15121512
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
1513-
ERROR HY000: Incorrect arguments to st_buffer
1513+
count(*)
1514+
1
15141515
DROP DATABASE gis_ogs;
15151516
#
15161517
# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,8 @@ MULTIPOLYGON(((52 18,48 6,73 9,66 23,52 18),(59 18,67 18,67 13,59 13,59 18)),((6
15041504
SELECT count(*)
15051505
FROM buildings, bridges
15061506
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;
1507-
ERROR HY000: Incorrect arguments to st_buffer
1507+
count(*)
1508+
1
15081509
DROP DATABASE gis_ogs;
15091510
#
15101511
# Bug#13362660 ASSERTION `FIELD_POS < FIELD_COUNT' FAILED. IN PROTOCOL_TEXT::STORE

mysql-test/suite/innodb_gis/t/1.test

-1
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,6 @@ WHERE lakes.name = 'Blue Lake'
14281428
AND named_places.name = 'Ashton';
14291429

14301430
--echo # Conformance Item T51
1431-
--error ER_WRONG_ARGUMENTS
14321431
SELECT count(*)
14331432
FROM buildings, bridges
14341433
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;

mysql-test/suite/innodb_gis/t/gis.test

-1
Original file line numberDiff line numberDiff line change
@@ -1414,7 +1414,6 @@ WHERE lakes.name = 'Blue Lake'
14141414
AND named_places.name = 'Ashton';
14151415

14161416
--echo # Conformance Item T51
1417-
--error ER_WRONG_ARGUMENTS
14181417
SELECT count(*)
14191418
FROM buildings, bridges
14201419
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;

mysql-test/t/gis.test

-1
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,6 @@ WHERE lakes.name = 'Blue Lake'
14401440
AND named_places.name = 'Ashton';
14411441

14421442
--echo # Conformance Item T51
1443-
--error ER_WRONG_ARGUMENTS
14441443
SELECT count(*)
14451444
FROM buildings, bridges
14461445
WHERE ST_Contains(ST_Buffer(bridges.position, 15.0), buildings.footprint) = 1;

sql/item_geofunc_buffer.cc

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -422,12 +422,6 @@ String *Item_func_buffer::val_str(String *str_value_arg)
422422
}
423423
}
424424

425-
if (geom->get_srid() != 0)
426-
{
427-
my_error(ER_WRONG_ARGUMENTS, MYF(0), func_name());
428-
DBUG_RETURN(error_str());
429-
}
430-
431425
/*
432426
If distance passed to ST_Buffer is too small, then we return the
433427
original geometry as its buffer. This is needed to avoid division

0 commit comments

Comments
 (0)