It's necessary to calculate the actual intersection, e.g. http://postgis.refractions.net/docs/ST_Intersection.html SELECT ST_Length(ST_Intersection(line,polygon)) FROM lines WHERE road = "Road 7" AND ST_Intersects(line, polygon)