SQLite Forum

Some comments about RETURNING
Login
> However, I do think that diverting the returning into another table should be implemented. I don't know what PostgreSQL does, although if PostgreSQL doesn't already have a syntax for that (or its syntax is no good), then I can suggest: ...

PostgreSQL has this syntax for using DML with a RETURN clause ("DMLR"):<code>
  WITH some_name AS \<DML with a RETURN clause\>
   \<query or DML using some_name as a table-like object\>
</code>

With the capability indicated by that syntax, the DMLR results can be captured in a temp table if they are to be used for successive operations. I think this reduces the attraction of adding more complex syntax to enable "chaining" because it is a simple matter to use a temp table then drop it. An implementation might even optimize for that case by simply collecting the DMLR results directly into a named temp table.

(No comment on DMLR with virtual tables.)