From 80508aa387660dad80bd56f17e82fc1f115af850 Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Thu, 14 Apr 2022 10:33:38 +0100 Subject: [PATCH] fix insert statement --- etl/load_new_geometries.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etl/load_new_geometries.sh b/etl/load_new_geometries.sh index 3607a8df..9af6601d 100644 --- a/etl/load_new_geometries.sh +++ b/etl/load_new_geometries.sh @@ -37,8 +37,10 @@ psql -c "CREATE TABLE IF NOT EXISTS new_geometries ( echo "Finding geometries that are new to this release..." psql -c "INSERT INTO new_geometries ( source_id, geometry_geom ) SELECT source_id, geometry_geom - FROM release_geometries - WHERE NOT EXISTS ( SELECT source_id FROM geometries );" + FROM release_geometries AS r + WHERE NOT EXISTS ( SELECT source_id + FROM geometries AS g + WHERE g.source_id = r.source_id);" echo "Adding new geometries to geometries table..." psql -c "INSERT INTO geometries ( source_id, geometry_geom )