In PostgreSQL 8.2, we got "RETURNING" clause in INSERT/UPDATE/DELETE queries. Unfortunately it could not be used as source of rows for anything in sql. insert into table_backup delete from table where ... returning *; Well, it's still not possible, but it is a ...