Pavan Deolasee wrote: > On Thu, Jan 26, 2017 at 2:38 AM, Alvaro Herrera <alvherre@2ndquadrant.com> > wrote:
> > The simple_heap_update + CatalogUpdateIndexes pattern is getting > > obnoxious. How about creating something like catalog_heap_update which > > does both things at once, and stop bothering each callsite with the WARM > > stuff? > > What I realised that there are really 2 patterns: > 1. simple_heap_insert, CatalogUpdateIndexes > 2. simple_heap_update, CatalogUpdateIndexes > > There are only couple of places where we already have indexes open or have > more than one tuple to update, so we call CatalogIndexInsert directly. What > I ended up doing in the attached patch is add two new APIs which combines > the two steps of each of these patterns. It seems much cleaner to me and > also less buggy for future users. I hope I am not missing a reason not to > do combine these steps.
CatalogUpdateIndexes was just added as a convenience function on top of a very common pattern. If we now have a reason to create a second one because there are now two very common patterns, it seems reasonable to have two functions. I think I would commit the refactoring to create these functions ahead of the larger WARM patch, since I think it'd be bulky and largely mechanical. (I'm going from this description; didn't read your actual code.)
Sounds good. Should I submit that as a separate patch on current master?