I'm trying to cut holes in forest polygons, where there are lakes.
My PostGIS/PostgreSQL code look like this:
CREATE TABLE samp.forest_with_holes AS SELECT fo.objectid, (CASE ST_Intersects(fo.geom, la.geom) WHEN TRUE THEN ST_Difference(fo.geom, so.geom) ELSE fo.geom END CASE;) as geom from samp.forest as fo, samp.lake as la;
But I get the error message:
ERROR: syntax error at or near "CASE" LINE xx: END CASE;) as geom
Can anybody help me to see why this is not working - and please suggest a better way :-)