Re: Functional dependencies and GROUP BY
Greg Stark <gsstark@mit.edu>
From: Greg Stark <gsstark@mit.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter_e@gmx.net>, pgsql-hackers@postgresql.org
Date: 2010-06-08T12:40:51Z
Lists: pgsql-hackers
On Tue, Jun 8, 2010 at 4:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote: > Peter Eisentraut <peter_e@gmx.net> writes: >> I have developed a patch that partially implements the "functional >> dependency" feature that allows some columns to be omitted from the >> GROUP BY clause if it can be shown that the columns are functionally >> dependent on the columns in the group by clause and therefore guaranteed >> to be unique per group. > > The main objection to this is the same one I've had all along: it makes > the syntactic validity of a query dependent on what indexes exist for > the table. At minimum, that means that enforcing the check at parse > time is the Wrong Thing. It also needs to ensure that the plan is invalidated if the constraint is dropped, which I assume amounts to the same thing. -- greg