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

From Stephen Frost
Subject Re: Functional dependencies and GROUP BY
Date
Msg-id 20100608151620.GO21875@tamriel.snowman.net
Whole thread Raw
In response to Re: Functional dependencies and GROUP BY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Functional dependencies and GROUP BY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> Perhaps the correct fix would be to mark stored query trees as having a
> dependency on the index, so that dropping the index/constraint would
> force a drop of the rule too.  Just pushing the check to plan time, as
> I suggested yesterday, isn't a very nice fix because it would result
> in the rule unexpectedly starting to fail at execution.

Alternatively, we could rewrite the rule (not unlike what we do for
"SELECT *") to actually add on the other implicitly grouped-by columns..
I don't know if that's better or worse than creating a dependency,
since if the constraint were dropped/changed, people might expect the
rule's output to change.  Of course, as you mention, the alternative
would really be for the rule to just start failing..  Still, if I wanted
to change the constraint, it'd be alot nicer to just be able to change
it and, presuming I'm just adding a column to it or doing some other
change which wouldn't invalidate the rule, not have to drop/recreate
the rule.
Thanks,
    Stephen

pgsql-hackers by date:

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