检测:
SELECT ST_IsValid(geom),ST_IsValidReason(geom) FROM tableName
修复
update tableName set geom=ST_MakeValid(geom)