SQLite Forum

inconsistent output: insert on conflict with returning
Login
I suppose he got it from the documentation.

See the INSERT...ON CONFLICT (aka UPSERT) documentation here:  [sqlite.org/lang_upsert.html#examples](https://sqlite.org/lang_upsert.html#examples)

As to the original question...

The OP is doing an UPSERT with RETURNING clause that works when the INSERT happens, but if conflicted and in stead an UPDATE happens, no row is returned (since no insert happened), which is probably as designed and as documented since the full RETURNING field-set might not be available to the UPDATE mechanism, the same as when the INSERT mechanism runs and the "excluded.xxx" construct is not available when INSERTing since no exclusion happened - so not sure the RETURNING clause can deal with both. 

I suspect it simply works for the INSERT part only as designed, but that is pure speculation on my part and as far as I can tell, no such limitation is documented, so it may simply be a bug.