Postgres SQL: INSERT from DELETE
You can use a data modifying common table expression:
with deleted as (
  DELETE FROM some_table
  WHERE id = 42
  returning user_id
)
INSERT INTO other_table(user_id, &quot;timestamp&quot;)
select user_id, timestamp '2020-01-04 21:32:34'
from deleted;