Re: Functional dependencies and GROUP BY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Functional dependencies and GROUP BY
Date
Msg-id 4409.1276006879@sss.pgh.pa.us
Whole thread Raw
In response to Re: Functional dependencies and GROUP BY  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: Functional dependencies and GROUP BY  (Marko Tiikkaja <marko.tiikkaja@cs.helsinki.fi>)
Re: Functional dependencies and GROUP BY  (Greg Stark <gsstark@mit.edu>)
Re: Functional dependencies and GROUP BY  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Peter Eisentraut <peter_e@gmx.net> writes:
> On tis, 2010-06-08 at 09:59 +0900, Hitoshi Harada wrote:
>> In addition, what if y is implicitly a constant? For example,
>> 
>> SELECT x, y FROM tab2 WHERE y = a AND a = 5 GROUP BY x;

> Yes, as I said, my implementation is incomplete in the sense that it
> only recognizes some functional dependencies.  To recognize the sort of
> thing you show,  you would need some kind of complex deduction or proof
> engine, and that doesn't seem worthwhile, at least for me, at this
> point.

The question is why bother to recognize *any* cases of this form.
I find it really semantically ugly to have the parser effectively
doing one deduction of this form when the main engine for that type
of deduction is elsewhere; so unless there is a really good argument
why we have to do this case (and NOT "it was pretty easy"), I don't
want to do it.

As far as I recall, at least 99% of the user requests for this type
of behavior, maybe 100%, would be satisfied by recognizing the
group-by-primary-key case.  So I think we should do that and be happy.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: Functional dependencies and GROUP BY
Next
From: Marko Tiikkaja
Date:
Subject: Re: Functional dependencies and GROUP BY