MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int).
When the distance in ST_BUFFER is too far negative the coordinates can run out of the operational area. We should just return an empty geometry in this case.
This commit is contained in:
parent
552f1b3505
commit
cfb7d5d78a
@ -1607,4 +1607,7 @@ 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 '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))
|
||||
GEOMETRYCOLLECTION EMPTY
|
||||
End of 5.5 tests
|
||||
|
@ -1465,4 +1465,9 @@ create table t1 (pt point);
|
||||
insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))'));
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# MDEV-7516 Assertion `!cur_p->event' failed in Gcalc_scan_iterator::arrange_event(int, int)
|
||||
#
|
||||
SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100));
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
@ -1286,6 +1286,13 @@ String *Item_func_buffer::val_str(String *str_value)
|
||||
|
||||
if (dist > 0.0)
|
||||
mbr.buffer(dist);
|
||||
else
|
||||
{
|
||||
/* This happens when dist is too far negative. */
|
||||
if (mbr.xmax + dist < mbr.xmin || mbr.ymax + dist < mbr.ymin)
|
||||
goto return_empty_result;
|
||||
}
|
||||
|
||||
collector.set_extent(mbr.xmin, mbr.xmax, mbr.ymin, mbr.ymax);
|
||||
/*
|
||||
If the distance given is 0, the Buffer function is in fact NOOP,
|
||||
@ -1313,6 +1320,7 @@ String *Item_func_buffer::val_str(String *str_value)
|
||||
goto mem_error;
|
||||
|
||||
|
||||
return_empty_result:
|
||||
str_value->set_charset(&my_charset_bin);
|
||||
if (str_value->reserve(SRID_SIZE, 512))
|
||||
goto mem_error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user