Data visibility for returning statement

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: robin(at)jonssonhector(dot)com
Subject: Data visibility for returning statement
Date: 2025-04-25 07:21:22
Message-ID: 174556568268.3018509.17516011309250353751@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/dml-returning.html
Description:

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?
Best regards
Robin

Browse pgsql-docs by date

  From Date Subject
Next Message Nathan Long 2025-04-28 15:07:21 `inet` docs suggestion and possible bug report
Previous Message Fujii Masao 2025-04-25 06:02:09 Re: Remove unnecessary secondary index terms for replication settings