Re: Attribute must be GROUPed.... ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Attribute must be GROUPed.... ?
Date
Msg-id 25379.1051749118@sss.pgh.pa.us
Whole thread Raw
In response to Re: Attribute must be GROUPed.... ?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List pgsql-hackers
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Yeah, that can get to be a problem...  In any case, you'll probably get
> other comments.  Oh yeah, and you'll probably be asked for documentation
> comments if it's even considered since you're adding a visible GUC entry.
> :)

Well, it won't be --- diking out required error checks without providing
a substitute isn't my idea of a useful patch ;)

The SQL99 spec defines an improved version of this behavior which I
think is what Daniele really would like to have.  Basically it says that
if column A can be proved functionally dependent on column B then you
only need to GROUP BY column B, and then you can use column A without
having to explicitly mention it in the GROUP BY list.  "Functionally
dependent" means there is no possibility of A values being different in
rows with the same B value.  The spec has a whole lot of verbiage about
possible ways to deduce functional dependency, but one easy one is where
column B is a primary key and column A is in its table.

If someone wants to implement the SQL99 behavior (or even just a useful
subset of it), that would be cool with me.  It looks like a lot of work
though.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Attribute must be GROUPed.... ?
Next
From: "Andrew Dunstan"
Date:
Subject: Re: Attribute must be GROUPed.... ?