Thread

  1. Re: [PATCH] refint: Avoid reusing cascade UPDATE plans.

    Nathan Bossart <nathandbossart@gmail.com> — 2026-05-15T17:27:22Z

    On Fri, May 15, 2026 at 08:34:55PM +0530, Ayush Tiwari wrote:
    > On Fri, 15 May 2026 at 20:16, Nathan Bossart <nathandbossart@gmail.com>
    > wrote:
    >> Big +1 for removing it in v20.  Or maybe even v19.  I do think it is worth
    >> trying to fix the more egregious bugs, though, as the code will still be
    >> supported for a few years.
    > 
    > I agree on the removal part.
    
    Cool.  Do you want to write the patch for that, too?  I think we should aim
    for removing it shortly after v20 opens for development.  It might be best
    to move that to its own thread so that folks are aware and have a chance to
    object.
    
    > In the meantime, since the module will still be
    > supported for a while, this seems like a focused fix for the more
    > egregious cache behavior.
    > 
    > Attached v3 removes the private SPI plan cache from refint entirely.
    > Both check_primary_key() and check_foreign_key() now prepare their SPI
    > plans per trigger invocation and let SPI_finish() release them.
    
    I'm not sure I'd bother with the tests.  At a glance the rest looks
    generally reasonable.  I realize that leaving the braces around the plan
    preparation logic keeps the patch small, but we probably wouldn't write it
    that way today.  I'd suggest moving the local variable declarations to the
    top of the function in your patch, and then doing a follow-up patch to
    re-pgindent the file.  Also, I don't think we need any of the comments
    about the historical usage of a cache; let's just clean house.
    
    -- 
    nathan