pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: lacroix.robert@outlook.com
Subject: https://www.postgresql.org/docs/current/sql-insert.html
Date: Sat, 02 Nov 2024 09:41:53 +0000
Message-ID: <173054051344.697.17098388380226931495@wrigleys.postgresql.org> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-insert.html
Description:

Hi,
the example found in the doc above:

WITH upd AS (
  UPDATE employees SET sales_count = sales_count + 1 WHERE id =
    (SELECT sales_person FROM accounts WHERE name = 'Acme Corporation')
    RETURNING *
)
INSERT INTO employees_log SELECT *, current_timestamp FROM upd;

might result into UPDATE 0 / INSERT 0 because the documentation regarding
the CTE states: "The sub-statements in WITH are executed concurrently with
each other and with the main query".
The subquery SELECT sales_person FROM accounts WHERE name = 'Acme
Corporation' might not be waited on by the UPDATE query resulting into an
UPDATE 0.
Is my suspicion valid?


view thread (2+ messages)  latest in thread

Message-ID: <173054051344.697.17098388380226931495@wrigleys.postgresql.org>
Permalink:  ../173054051344.697.17098388380226931495@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/173054051344.697.17098388380226931495@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, lacroix.robert@outlook.com
  Subject: Re: https://www.postgresql.org/docs/current/sql-insert.html
  In-Reply-To: <173054051344.697.17098388380226931495@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 DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox