On Tue, Oct 17, 2006 at 04:45:49PM -0400, Mark Woodward wrote:
> Well, this started out as a "huh, that's funny, that should work, is that
> a bug?" and is turning into a search through the SQL99 spec for a clear
> answer. I've already worked around it, but to me, at least, it seems it
> should work.

What you're asking for is difficult, not done by anyone else (so far
demostrated) and not mandated by the spec, so I don't see how it could
be construed a bug.

As for the spec, this is what I have from SQL2003:

7.12.15) If T is a grouped table, then let G be the set of grouping
  columns of T. In each <value expression> contained in <select list>,
  each column reference that references a column of T shall reference
  some column C that is functionally dependent on G or shall be
  contained in an aggregated argument of a <set function specification>
  whose aggregation query is QS.

Which to me says that everything in the output is either grouped by or
part of an aggregate. That together with a statement elsewhere saying
that if no group by clause is present, GROUP BY () is implied seems to
seal it for me.

(BTW, the "functionally dependent" is new and postgresql only supports
the older SQL standards where C has to actually be a grouping column).

Have a nice day,
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to 
> litigate.

Attachment: signature.asc
Description: Digital signature

Reply via email to