So I have a large select query that has over 1700 rows which basically extracts data from various tables (some points, some lines, with various conditions in between them) that intersect with a polygon table
select a.id
(select count(*) from pointtable2 b where st_contains(a.geom,b.geom ) )
(select sum(st_length(st_intersection(a.geometry, r.geometry))) from linetable3 b where st_intersects(a.geom,b.geom ) ),
(select a whole bunch of stuff from several other tables where multitude of conditions..)
from polygontable a
group by a.id, a.geom
One line layer in particular has invalid geometries which initially I dealt with by adding on the where condition
geometrytype(r.geom) <> 'MULTICURVE'::text AND st_isvalid(r.geom) is true
Problem is, even with these conditions, I'm still getting the following error
SQL Error [XX000]: ERROR: GEOSIntersects: IllegalArgumentException: RobustDeterminant encountered non-finite numbers
ERROR: GEOSIntersects: IllegalArgumentException: RobustDeterminant encountered non-finite numbers
ERROR: GEOSIntersects: IllegalArgumentException: RobustDeterminant encountered non-finite numbers
Fixing the wrong geometries would be the long term solution but this report view is needed with urgency, what would be the best way of running my query while ignoring failing rows? Or how would I be able to spot which geometries/which lines of code have failed?