New vs old values collision in UPDATE RETURNING docs

PG Doc comments form <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.documentation
Message-ID <[email protected]>
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/sql-update.html
Description:

What we have in doc:
<q>
[ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
output_expression: An expression to be computed and returned by the UPDATE
command after each row is updated.
</q>
What we have in the wild (Pg8..11):
* when using field names, expression represents NEW values after update;
* when using sub-selects or joined table references, expression represents
OLD values before update.

POC code:
<code>
create temporary table test(id int primary key, status text not null);

insert into test(id, status) values(1, 'initial');

update test t set status='new'
where id=1
returning id,
    status as new_status,
    (select status from test where id=t.id) as old_status;
</code>

Thus that "after each row is updated" sentence is rather confusing.

/Alexey
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.