I am using this query to insert record from one table into another table:
insert into watched_url_queue_work select * from watched_url_queue
on conflict do nothing
The unique constraints on the target table mean not all are inserted.
What I want to now do is delete all of the records that I just inserted but I am not sure of syntax.
I want something like (query not working just my guess at it):
delete from watched_url_queue q
where q.target_domain_record_id in
(
insert into watched_url_queue_work select * from watched_url_queue
on conflict do nothing
returning watched_url_queue_work.target_domain_record_id
)