Re: Joins of data-modifying CTE with the target table - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Joins of data-modifying CTE with the target table
Date
Msg-id e8ad8aca-c0e4-65f8-e51c-fde543db62fa@aklaver.com
Whole thread Raw
In response to Re: Joins of data-modifying CTE with the target table  (Alex Bolenok <quassnoi@gmail.com>)
List pgsql-general
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




pgsql-general by date:

Previous
From: Alex Bolenok
Date:
Subject: Re: Joins of data-modifying CTE with the target table
Next
From: Tom Lane
Date:
Subject: Re: Joins of data-modifying CTE with the target table