Add regression test for GiST index crash on empty (#1697)

Also tests you can query all empty items from an index

git-svn-id: http://svn.osgeo.org/postgis/trunk@9567 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2012-03-28 09:19:22 +00:00
parent 1953861f83
commit d95b1cf3ec
2 changed files with 16 additions and 0 deletions

View file

@ -631,5 +631,18 @@ WITH inp AS ( SELECT
-- #1695
SELECT '#1695', ST_AsEWKT(ST_SnapToGrid('MULTIPOLYGON(((0 0, 10 0, 10 10, 0 10, 0 0)))'::geometry, 20));
-- #1697 --
CREATE TABLE eg(g geography, gm geometry);
CREATE INDEX egi on eg using gist (g);
CREATE INDEX egind on eg using gist (gm gist_geometry_ops_nd);
INSERT INTO eg (g, gm)
select 'POINT EMPTY'::geography,
'POINT EMPTY'::geometry
from generate_series(1,1024);
SELECT '#1697.1', count(*) FROM eg WHERE g && 'POINT(0 0)'::geography;
SELECT '#1697.2', count(*) FROM eg WHERE gm && 'POINT(0 0)'::geometry;
SELECT '#1697.3', count(*) FROM eg WHERE gm ~= 'POINT EMPTY'::geometry;
DROP TABLE eg;
-- Clean up
DELETE FROM spatial_ref_sys;

View file

@ -210,3 +210,6 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0
#1596.7|0
#1596|Point[BG]
#1695|MULTIPOLYGON EMPTY
#1697.1|0
#1697.2|0
#1697.3|1024