Re: Aggregates containing outer references don't work per

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Aggregates containing outer references don't work per
Date: 2003-06-05 16:57:47
Message-ID: 3EDF768B.5060607@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
>> When we considered outervar1 as a constant, we could do the aggregate in
>> the subquery using computations, but when SUM(outervar1) is computed in
>> an above query, combining that with anything that is part of different
>> query level makes no sense to me because those variables might not even
>> exist at the level that aggregate is being computed.
>
> Sure they will. They can only be outer (up-level) references, else the
> parser would not have resolved them in the first place.
>
> If you accept that SUM(localvar + outervar) is a sensible computation,
> then I think you must accept that SUM(outervar1 + outervar2) makes sense
> too. It's actually the exact same computation, it's just being
> referenced from within a sub-query.

What is SUM(up1levelvar + up2levelsvar) considered to be? Would that be
the same as SUM(localvar + outervar) one level up?

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-06-05 17:07:44 Re: Aggregates containing outer references don't work per spec
Previous Message scott.marlowe 2003-06-05 15:59:32 Re: [HACKERS] Broken RR?