diff --git a/etl/create_new_building_records.sh b/etl/create_new_building_records.sh index cf3f7f36..e6421558 100644 --- a/etl/create_new_building_records.sh +++ b/etl/create_new_building_records.sh @@ -6,4 +6,9 @@ # doc: {}, # geom_id: # -psql -c "INSERT INTO buildings ( geometry_id, ref_toid ) SELECT geometry_id, source_id from new_geometries;" +psql -c "INSERT INTO buildings ( geometry_id, ref_toid ) + SELECT geometry_id, source_id + FROM geometries AS g + WHERE EXISTS ( SELECT source_id + FROM new_geometries AS ng + WHERE g.source_id = ng.source_id);"