I don't find it that confusing, to be honest. When the article presented the "mysterious" query, I guessed the result correctly. A correlated subquery will always execute the entire expression for each row of the outer query. Since the value of `sum(a)` is known in the context of the outer query, it doesn't really matter where you select it from in the inner query. Therefore, the following queries are all identical:
SELECT sum(a) FROM aa;
SELECT (SELECT sum(a) FROM xx LIMIT 1) FROM aa;
SELECT (SELECT sum(a) FROM generate_series(1, 1)) FROM aa;
To maybe explain why this behaviour makes sense, stop thinking about aggregate queries for a second, and just consider normal expressions. What would you expect the result of the following query to be?
SELECT (SELECT a + x FROM xx LIMIT 1) FROM aa;
This is obviously a bad query because it uses `LIMIT` without `ORDER BY`, but let's just put that aside. This query should make some sense to pretty much any SQL developer: you take each `a` value from `aa`, and then add the value from the "first" (whatever that means) `x` value from `xx` to it. (In my test on Postgres, this returns [11, 12, 13], but there's obviously no guarantee because we neglected to sort `xx`.)
Now, since that was easy, consider this simplification of that query:
SELECT (SELECT a FROM xx LIMIT 1) FROM aa;
I think that if the previous query made sense, this one should also make sense, as the expression simple has one less term. The result is obviously [1, 2, 3].
So, what should the aggregate return:
SELECT (SELECT sum(a) FROM xx LIMIT 1) FROM aa;
The only real difference is that the outer query is now aggregated, and therefore it is implicitly in one big grouping, and therefore returns only one row. So the correlated subquery gets run once, for that one row - what's the value for `sum(a)` in that row, the one row that the outer query returns? Well, 6. Duh.