From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alex Bolenok <quassnoi@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Joins of data-modifying CTE with the target table
Date: Wed, 19 Apr 2023 11:46:04 -0400
Message-ID: <2983382.1681919164@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMX8OqKTEVZSyi2ZXD9Z_ZV717FwDwx4-OB=4xH1Q9Z885VmDg@mail.gmail.com>
References: <CAMX8OqKTEVZSyi2ZXD9Z_ZV717FwDwx4-OB=4xH1Q9Z885VmDg@mail.gmail.com>
Alex Bolenok <quassnoi@gmail.com> writes:
> I get why it's not working (because the statement is not allowed to see the
> tuples with its own cmin), but I was wondering if it was worth it at least
> to spell it out explicitly in the documentation.
What's not explicit about this?
The sub-statements in WITH are executed concurrently with each other
and with the main query. Therefore, when using data-modifying
statements in WITH, the order in which the specified updates actually
happen is unpredictable. All the statements are executed with the same
snapshot (see Chapter 13), so they cannot “see” one another's effects
on the target tables.
regards, tom lane
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, quassnoi@gmail.com
Subject: Re: Joins of data-modifying CTE with the target table
In-Reply-To: <2983382.1681919164@sss.pgh.pa.us>
References: <CAMX8OqKTEVZSyi2ZXD9Z_ZV717FwDwx4-OB=4xH1Q9Z885VmDg@mail.gmail.com> <2983382.1681919164@sss.pgh.pa.us>
* 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