SQLite Forum

Crash when a RETURNING clause refers to a table in UPDATE FROM
> It's unclear whether that makes any sense or is an implementation artifact.

I think that it doesn't really make sense, but what I think might make sense is to allow "old" and "new" in RETURNING like is allowed in triggers, so that a UPDATE can return the old and new values. For upsert, the old values would be null if there is no conflict, and perhaps "excluded" might also be allowed, for the value that would be inserted if there were no conflict.