From: | PG Doc comments form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-docs(at)lists(dot)postgresql(dot)org |
Cc: | lacroix(dot)robert(at)outlook(dot)com |
Subject: | https://www.postgresql.org/docs/current/sql-insert.html |
Date: | 2024-11-02 09:41:53 |
Message-ID: | 173054051344.697.17098388380226931495@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/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?
From | Date | Subject | |
---|---|---|---|
Next Message | jian he | 2024-11-03 13:58:00 | Re: Tip box on Adding a Column |
Previous Message | Marcelo Fernandes | 2024-11-01 23:02:14 | RE: Tip box on Adding a Column |