From 33041761c6907ebe9e78fe1b73f0ed4063278609 Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Fri, 14 Feb 2020 15:42:41 -0500 Subject: [PATCH] drop rows from both tables when undoing changes --- route_sql/undo.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/route_sql/undo.sql b/route_sql/undo.sql index 2c2b100..e5bc8b0 100644 --- a/route_sql/undo.sql +++ b/route_sql/undo.sql @@ -1,5 +1,8 @@ WITH d AS ( -DELETE FROM rlarp.osm_log WHERE id = replace_id RETURNING id + DELETE FROM rlarp.osm_log WHERE id = replace_id RETURNING id +) +,d_osm AS ( + DELETE FROM rlarp.osm_pool WHERE logid IN (select id from d) ) SELECT json_agg(row_to_json(d)) x from d \ No newline at end of file