Chris Cogdon <chris@felidae.apana.org.au> writes:
> On Mon, 28 Feb 2000, Tom Lane wrote:
>> regression=# select * from span where min > 3;
> Note that under 6.4 and 6.5, the result of a aggregate (or a subquery,
> even) has to be on the RHS Of an operator. Viz:
> The fact that this error does not come up in 7 either means that they've
> fixed a limitation,
They (that is, I) fixed it. However, that's just a removal of
one small limitation in code that's fundamentally bogus to start
with :-(. The rewriter's entire approach to aggregates that it
inserts into WHERE is wrong.
> Can you try it with
> select * from span where 3<min;
> and see what you get.
The same thing.
> Okay... here's a test under 6.5.2:
> test1=> select * from span having 0<min;
> ERROR: SELECT/HAVING requires aggregates to be valid
> Does this work under 7.beta?
No:
regression=# select * from span having 0<min;
ERROR: Attribute span.ref must be GROUPed or used in an aggregate function
The appearance of this particular error might represent a fixable bug,
but that's small comfort knowing that the "0 < min" part cannot possibly
work as you want it to. It's tough to justify putting much effort into
patching small bugs in a chunk of code that I know needs to be thrown
away and rewritten in toto...
regards, tom lane