Today I found a pretty special use-case for the "RETURNING" functionality, which I cannot find documentation for? If you have a statement as follows: UPDATE persons SET name = 'Bob' WHERE id = 4 RETURNING (SELECT name FROM persons WHERE id = 4) The returning data will be whatever the value was before the row was modified. This differs from if I were to "RETURNING name". I found this to be interesting and could possibly warrant some kind of explanation in the documentation?
I would not want to encourage that form of query. The novelty is more problematic than the brevity. Plus, repetition.
with new_p as ( update persons set name = 'Bob' returning name where id = 4)