agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: robin@jonssonhector.com
Subject: Data visibility for returning statement
Date: Fri, 25 Apr 2025 07:21:22 +0000
Message-ID: <174556568268.3018509.17516011309250353751@wrigleys.postgresql.org> (raw)

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


view thread (2+ messages)  latest in thread

Message-ID: <174556568268.3018509.17516011309250353751@wrigleys.postgresql.org>
Permalink:  ../174556568268.3018509.17516011309250353751@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/174556568268.3018509.17516011309250353751@wrigleys.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, robin@jonssonhector.com
  Subject: Re: Data visibility for returning statement
  In-Reply-To: <174556568268.3018509.17516011309250353751@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox