Re: [HACKERS] Aggregates containing outer references don't work per spec

2003-06-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> 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

Re: [HACKERS] Aggregates containing outer references don't work per spec

2003-06-05 Thread Tom Lane
I wrote: > Now I finally understand why the spec has all that strange verbiage > about outer references in set-function arguments. This is the case > they're talking about. (I don't much like their restriction to a single > outer reference ... seems like it would be appropriate to allow multiple >

Re: [HACKERS] Aggregates containing outer references don't work per spec

2003-06-05 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > What is SUM(up1levelvar + up2levelsvar) considered to be? Would that be > the same as SUM(localvar + outervar) one level up? Exactly. The spec says that SUM(up1levelvar) is the same as SUM(localvar) one level up, so this seems a natural generalization. It

Re: [HACKERS] Aggregates containing outer references don't work per spec

2003-06-04 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > Would > SELECT PNUM, SUM(HOURS) FROM WORKS >GROUP BY PNUM >HAVING EXISTS (SELECT PNAME FROM PROJ > WHERE PROJ.PNUM = WORKS.PNUM AND > AVG(WORKS.HOURS) > PROJ.MAGIC / 200);