On Tue, Jan 31, 2017 at 7:21 PM, Alvaro Herrera <alvhe...@2ndquadrant.com>
> Pavan Deolasee wrote:
> > On Thu, Jan 26, 2017 at 2:38 AM, Alvaro Herrera <
> > 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
> > > 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
> > more than one tuple to update, so we call CatalogIndexInsert directly.
> > 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?
Pavan Deolasee http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services