Re: max(*) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: max(*)
Date
Msg-id 26023.1148655797@sss.pgh.pa.us
Whole thread Raw
In response to Re: max(*)  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: max(*)
List pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> On Fri, 2006-05-26 at 10:22 +0200, Dennis Bjorklund wrote:
>> Shouldn't
>> SELECT max(*) FROM foo;
>> give an error? 

> Doesn't seem an important or even useful extension of the standard, but
> would probably require special case processing for every aggregate
> function in order to implement that. Its not dangerous... so I'm not
> sure we should take any action at all.

We shouldn't.  The spec's prohibition is based on the assumption that
the only aggregate functions in existence are those listed in the spec.
Since we allow user-defined aggregates, who are we to say that there are
no others for which "*" is sensible?

You could imagine adding a catalog attribute to aggregate functions to
say whether they allow "*", but quite honestly that strikes me as a
waste of implementation effort.  The amount of work would be nontrivial
and the benefit negligible.

(Another possibility, if we get around to implementing N-argument
aggregates, is to equate "agg(*)" to an invocation of a zero-argument
aggregate as I suggested awhile ago.  Then count() would be the only
zero-argument aggregate mentioned in the standard catalogs.  That would
at least fall out of some work that's actually worth doing ...)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Updatable views/with check option parsing
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Updatable views/with check option parsing