I've created a function called 'ST_LineFishnet' which makes a grid network of line string geometry. I wanted to split a polygon shapefile with my grid. I've just used the first grid as "LINESTRING(0 0,0 10,10 10,10 0,0 0)" to split my shapefile according to this snippet code, but the problem is it always return geometry even two geometries don't have any intersection.
How can I check if my grid intersects with polygon before split function?
SELECT ST_AsEWKT(wkt) As result FROM (SELECT ST_AsText((ST_Dump(ST_Split(circle, line))).geom) As wkt FROM (SELECT (SELECT ST_AsEWKT(geom) FROM ( SELECT geom FROM ST_LineFishnet(4,6,10,10) As cells WHERE col=1 AND row=1) As koo) As line, (SELECT ST_AsEWKT(geo) FROM (SELECT geom As geo FROM block WHERE gid = 1) As k) As circle) As foo) As m;