From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Alex Bolenok <quassnoi@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Joins of data-modifying CTE with the target table
Date: Wed, 19 Apr 2023 09:42:45 -0700
Message-ID: <e8ad8aca-c0e4-65f8-e51c-fde543db62fa@aklaver.com> (raw)
In-Reply-To: <CAMX8OqKQqHAJmP=Ph28W_o=2En+BqRjJ4WrWf3ovTd2m8SaSTw@mail.gmail.com>
References: <CAMX8OqKTEVZSyi2ZXD9Z_ZV717FwDwx4-OB=4xH1Q9Z885VmDg@mail.gmail.com>
<2983382.1681919164@sss.pgh.pa.us>
<CAMX8OqKQqHAJmP=Ph28W_o=2En+BqRjJ4WrWf3ovTd2m8SaSTw@mail.gmail.com>
On 4/19/23 09:09, Alex Bolenok wrote:
> To reiterate, I (I personally) get why it's not working, but the
> documentation is something that is intended for people who don't.
>
> Technically, anyone can deduce it from reading the documentation
> thoroughly enough, but do we need the documentation to be as terse
> as possible?
Not so much terse as possible as not as verbose as possible. The
difference being that documenting every possible usage would turn the
page into an eye glazing experience. At that point folks would really
just move on. The documentation expectations(as I see it) are that: 1)
People can work from basic principles to specific usage. 2) They also
actually test/verify what they run.
What you are after is more on the lines of a separate enhanced tutorial.
That has been discussed on this list and elsewhere. So far it has not
progressed beyond discussion.
>
> To answer your question, by "explicitly" I mean mentioning this very
> pattern, where you join the returned id with the target table. People
> often try to use this pattern for queries like "add an item to the order
> in a CTE, select the order total in the main query", and often don't
> notice that the order total doesn't include the new item until it hits
> production.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
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: adrian.klaver@aklaver.com, quassnoi@gmail.com
Subject: Re: Joins of data-modifying CTE with the target table
In-Reply-To: <e8ad8aca-c0e4-65f8-e51c-fde543db62fa@aklaver.com>
References: <CAMX8OqKTEVZSyi2ZXD9Z_ZV717FwDwx4-OB=4xH1Q9Z885VmDg@mail.gmail.com> <2983382.1681919164@sss.pgh.pa.us> <CAMX8OqKQqHAJmP=Ph28W_o=2En+BqRjJ4WrWf3ovTd2m8SaSTw@mail.gmail.com> <e8ad8aca-c0e4-65f8-e51c-fde543db62fa@aklaver.com>
* 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