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

From Tom Lane
Subject Re: Functional dependencies and GROUP BY
Date
Msg-id 4168.1276005935@sss.pgh.pa.us
Whole thread Raw
In response to Re: Functional dependencies and GROUP BY  (Greg Stark <gsstark@mit.edu>)
Responses Re: Functional dependencies and GROUP BY  (Greg Stark <gsstark@mit.edu>)
Re: Functional dependencies and GROUP BY  (Stephen Frost <sfrost@snowman.net>)
Re: Functional dependencies and GROUP BY  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> On Tue, Jun 8, 2010 at 4:16 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.

Well, no, any cached plan will get invalidated if the index goes away.
The big problem with this implementation is that you could create a
*rule* (eg a view) containing a query whose validity depends on the
existence of an index.  Dropping the index will not cause the rule
to be invalidated.

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.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: [BUGS] Invalid YAML output from EXPLAIN
Next
From: Jan Wieck
Date:
Subject: Re: Idea for getting rid of VACUUM FREEZE on cold pages