From 5800b578d49011d5a357b9cd3fed0b4c9922d7b8 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 14 Apr 2022 14:21:35 +0100 Subject: [PATCH] fix create new buildings --- etl/create_new_building_records.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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);"