public inbox for [email protected]
help / color / mirror / Atom feedFrom: David G. Johnston <[email protected]>
To: Adrian Klaver <[email protected]>
Cc: PALAYRET Jacques <[email protected]>
Cc: [email protected]
Subject: Re: PostgreSQL query with FULL OUTER JOIN and subquery using column of GROUP BY expression ERROR: subquery uses ungrouped column from outer query
Date: Wed, 25 Feb 2026 09:20:18 -0700
Message-ID: <CAKFQuwY27TZSERWdmC+=RO+B86KAOSW+CeJSSL52eUZQLYZsrA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
On Wed, Feb 25, 2026 at 9:00 AM Adrian Klaver <[email protected]>
wrote:
> 1) Why FROM (SELECT * FROM t1 ) AS t1 instead of just FROM t1?
> Same for JOIN (SELECT * FROM t3 ) t3
>
Seems immaterial. It's just a consequence of simplifying the original
problem query. If it is consequential that would seem buggy.
> 2) Why are the field names not table qualified e.g. t2.id, t3.id, etc?
>
Because of the USING clause, those references shouldn't exist in the main
query.
> 3) What is the desired outcome?
>
For the engine to realize the 'id' in the group by and the 'id' in the
scalar subquery are the same 'id' - the one produced by the USING clause,
not either of the t2 or t3 ids.
My first impression is that this is a bug. Especially since the query
apparently executes in both left-join and right-join modes.
David J.
view thread (6+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: PostgreSQL query with FULL OUTER JOIN and subquery using column of GROUP BY expression ERROR: subquery uses ungrouped column from outer query
In-Reply-To: <CAKFQuwY27TZSERWdmC+=RO+B86KAOSW+CeJSSL52eUZQLYZsrA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox