Andres Freund <andres@2ndquadrant.com> writes:
> On 2014-11-01 14:19:22 -0400, Andrew Dunstan wrote:
>> Isn't the planner still going to try to use the index in that case? If it's
>> not then I'd be OK with it, but if it's going to make the table largely
>> unusable until it's reindexed that would be rather sad.
> Both the planner (for querying) and the executor (to avoid inserting
> tuples into the index) would have to query the state of such indexes. I
> don't think it can reasonably work otherwise.
The executor doesn't need to know anything, since the AM can trivially
make aminsert be a no-op if the index is internally invalid. The planner
only needs to know something if we think that silently being slow for a
query meant to search the index is better than throwing an error reminding
the user that the index needs to be reindexed.
regards, tom lane