> Should this not behave like if you drop (or create) an index > during a prepared statement? I have not yet looked closely at > this code to see what could be done. > > Regards,
I looked at this a bit more and ATExecEnableDisableIndex needs some tweaks. What should be getting invalidated in the heap relation that the index is on and not the index relation as it is in the current patch. You can retrieve the heap relation oid IndexGetRelation(indexOid, false) and the CacheInvalidateRelcache should be on the heap relation. The planner needs to only care about the heap relation invalidation to re-plan across multiple executions of a prepared statement. There should be a test for this scenario as well. Regards, Sami