WITH
d AS (
    DELETE FROM rlarp.osm_log WHERE id <> 1 AND 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
