Fix crash on NULL item in ND index (#1734)

Add regression testing for the case

git-svn-id: http://svn.osgeo.org/postgis/trunk@9577 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
Sandro Santilli 2012-03-29 12:37:42 +00:00
parent 4756ab8789
commit 504c4ac404
3 changed files with 16 additions and 5 deletions

View file

@ -212,17 +212,17 @@ static float gidx_union_volume(GIDX *a, GIDX *b)
return 0.0;
}
if ( gidx_is_unknown(a) && gidx_is_unknown(b) )
{
return 0.0;
}
if ( a == NULL || gidx_is_unknown(a) )
return gidx_volume(b);
if ( b == NULL || gidx_is_unknown(b) )
return gidx_volume(a);
if ( gidx_is_unknown(a) && gidx_is_unknown(b) )
{
return 0.0;
}
/* Ensure 'a' has the most dimensions. */
gidx_dimensionality_check(&a, &b);

View file

@ -644,5 +644,15 @@ 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;
-- #1734 --
create table eg (g geography);
create index egi on eg using gist (g);
INSERT INTO eg(g) VALUES (NULL);
INSERT INTO eg (g) VALUES ('POINT(0 0)'::geography);
INSERT INTO eg (g) select 'POINT(0 0)'::geography
FROM generate_series(1,1024);
SELECT '#1734.1', count(*) FROM eg;
DROP table eg;
-- Clean up
DELETE FROM spatial_ref_sys;

View file

@ -213,3 +213,4 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0
#1697.1|0
#1697.2|0
#1697.3|1024
#1734.1|1026