Opened 14 years ago

Closed 14 years ago

#723 closed defect (fixed)

ST_Intersection for geography is really messed up

Reported by: robe Owned by: pramsey
Priority: medium Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

I suspect geography ST_Intersection might not be the problem but it is the first to break. You need at least 2 records to break it. A simple ST_Intersect(geog1,geog2) will not do it. So might just be memory not being released.

SELECT ST_Intersection(a.geog, 
			b.geog) As result
FROM (VALUES (ST_GeogFromText('SRID=4326;POINT(-11.1111111 40)') ),
	(ST_GeogFromText('SRID=4326;POINT(-11.1111111 55)') ) ) As  a(geog)
	CROSS JOIN 
( VALUES (ST_GeogFromText('SRID=4326;POINT(-11.1111111 40)') ),
	(ST_GeogFromText('SRID=4326;POINT(-11.1111111 55)') )
	 ) As b(geog);	

— returns ERROR: Return size (40) not equal to expected size (16)!

Same error with POINT/POLYGON, POINT/LINESTRING but polygon one seems especially fatal.

— When I do the below query 3 times, server crashes

SELECT ST_Intersection(geography(foo1.the_geom),    
    geography(foo2.the_geom)) As result, 
   ST_AsText(foo1.the_geom) As ref1_geom, 
   ST_AsText(foo2.the_geom) As ref2_geom 
FROM ((SELECT ST_SetSRID(ST_Point(i,j),4326) As the_geom 
  FROM (SELECT a*1.11111111 FROM generate_series(-10,50,10) As a) As i(i) CROSS JOIN generate_series(40,70, 15) j ORDER BY i,j )) As foo1 CROSS JOIN ((SELECT ST_Buffer(ST_SetSRID(ST_Point(i,j),4326), j*0.05) As the_geom FROM (SELECT a*1.11111111 FROM generate_series(-10,50,10) As a) As i(i) CROSS JOIN generate_series(40,70, 20) As j ORDER BY i, i*j, j)) As foo2 
LIMIT 2;

Change History (3)

comment:1 by pramsey, 14 years ago

Thanks for continuing to find and report these in near-real-time Regina. I wish I could code more perfectly! Over the last week I've make changes in the box handling mostly, so I know it's in that area. If I was getting this bug later on when I've forgotten more, it would be a longer hunt.

comment:2 by pramsey, 14 years ago

That was a nice subtle bug and hopefully the fix for it reduces the odds of other such things happening in future! r6453

comment:3 by pramsey, 14 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.