Hi Robert, Thanks for your comments:
> If DETACH PARTITION and DROP PARTITION require this, why not ATTACH > PARTITION and CREATE TABLE .. PARTITION OF? > > For CREATE and ATTACH parition the invalidation of default relation is taken care by the following clean-up part in check_default_allows_bound(): + ResetExprContext(econtext); + CHECK_FOR_INTERRUPTS(); + } + + CacheInvalidateRelcache(part_rel); + MemoryContextSwitchTo(oldCxt); However, post your comment I carefully looked in the code I wrote here, and I see that this still explicitly needs cache invalidation in ATTACH and CREATE command, because the above invalidation call will not happen in case the default partition is further partitioned. Plus, I think the call to CacheInvalidateRelcache() in check_default_allows_bound() can be completely removed. This code however will be rearranged, as I plan to address Ashutosh's one of the comment to write a function for common code of ATExecAttachPartition() and check_default_allows_bound(). Regards, Jeevan Ladhe