CREATE TABLE "${newTableName}" AS SELECT public.ST_Buffer(geom, #{radius}) AS buffered_geom FROM "${tableName}" WHERE geom IS NOT NULL CREATE TABLE "${newTableName}" AS SELECT CASE WHEN b.geom IS NOT NULL THEN public.ST_Difference(a.geom, b.geom) ELSE a.geom END AS geom_result FROM "${tableNameB}" a LEFT JOIN "${tableNameA}" b ON public.ST_Intersects(a.geom, b.geom) WHERE b.geom IS NOT NULL AND a.id::VARCHAR IN #{tableId}