Is it possible to issue these in one query?

I have two SQL operations:
delete from names where bucket=%(bucket)s and id=%(name)s returning store, hash, oid;
and using the output of this:
delete from objects where store=%(store)s and hash=%(hash)s and id=%(oid)s and not exists (select 1 from names where store=%(store)s and hash=%(hash)s and oid=%(oid)s)

Is it possible (I guess maybe with CTE) to issue these as a single query, so I can spare network round trip time and additional costs?

Hey @bra,

To implement this you would have to use CTE and/or Subqueries.

Let me know if you were able to do it!

Thanks,
Matt