From 2f63f15aef4a074e22fe5ee2b99be5fc97a0335b Mon Sep 17 00:00:00 2001 From: Ed Chalstrey Date: Mon, 11 Apr 2022 10:18:54 +0100 Subject: [PATCH] copy all table columns --- etl/update_building_records.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/etl/update_building_records.sh b/etl/update_building_records.sh index 96753396..34ccbab4 100644 --- a/etl/update_building_records.sh +++ b/etl/update_building_records.sh @@ -14,12 +14,15 @@ # if geometry.TOID not in builings # Add TOID to temp table called new_geometries -# psql -c "CREATE TABLE new_geometries ( -# geometry_id serial PRIMARY KEY, -# source_id varchar(30) -# );" -psql -c "INSERT INTO new_geometries ( geometry_id, source_id ) - SELECT geometry_id, source_id +psql -c "CREATE TABLE new_geometries ( + geometry_id serial PRIMARY KEY, + source_id varchar(30), + geometry_geom geometry(GEOMETRY, 3857), + longitude float, + latitude float +);" +psql -c "INSERT INTO new_geometries * + SELECT * FROM geometries WHERE source_id NOT IN ( SELECT ref_toid FROM buildings);"