The 3rd result then correctly states that MERGE cannot be
used inside WITH.
Yes.
The first non-intro section says that the following syntax is allowed (you can attach WITH /TO/ MERGE)
[ WITH with_query [, ...] ]
MERGE INTO [ ONLY ] target_table_name [ * ] [ [ AS ] target_alias ]
The second section is saying that the "with_query" above cannot contain MERGE, i.e., you cannot put MERGE /IN/ WITH
Namely because you cannot attach a RETURNING clause to MERGE.
The intro makes it quite clear as well:
Specifically, reading the last sentence makes it clear:
Each auxiliary statement in a WITH clause can be a SELECT, INSERT, UPDATE, or DELETE; and the WITH clause itself is attached to a primary statement that can be a SELECT, INSERT, UPDATE, DELETE, or MERGE.
Here the inside is called the auxiliary while the outside is called primary.
David J.