Thread

  1. Re: Avoid orphaned objects dependencies, take 3

    Heikki Linnakangas <hlinnaka@iki.fi> — 2026-05-27T15:53:35Z

    On 26/05/2026 23:18, Bertrand Drouvot wrote:
    > On Tue, May 26, 2026 at 09:00:11PM +0300, Heikki Linnakangas wrote:
    >> - Added a test for a dependency on a role too, to cover the existing
    >> shdepLockAndCheckObject() function. It's currently disabled because it
    >> prints the OID, though.
    > 
    > Nit: It also adds:
    > 
    > +# function - role
    > +permutation "s1_begin" "s1_alter_function_owner" "s2_drop_role" "s1_commit"
    > 
    > That is not disabled and would already pass without the changes added in 0001.
    > 
    > So I wonder if we could just start by adding this new test (and the XXX one) in
    > a dedicated patch and then add 0001 that would focus on orphaned stuff only.
    
    True, we could do that. It doesn't really seem to me any better or worse 
    than just including it in the same commit though.
    
    > A few comments:
    > 
    > 1/
    > 
    > +#include "catalog/index.h"
    > 
    > That doesn't look needed.
    > 
    > 2/
    > 
    > It looks like pgindent "complains" on pg_depend.c for dependencyLockAndCheckObject().
    
    Fixed these, and did some more copy-editing on the comments. With that, 
    committed and backpatched. Version 14 needed a little more work to 
    backport because it didn't have IsPinnedObject(). And I noticed that 
    recordDependencyFor() was being called with InvalidOid on ALTER TABLE 
    commands on tables with dropped columns. That was bogus but harmless 
    before this patch; I fixed that too.
    
    Thanks!
    
    - Heikki