Re: Avoid orphaned objects dependencies, take 3

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Roman Eskin <r(dot)eskin(at)arenadata(dot)io>, Michael Paquier <michael(at)paquier(dot)xyz>, Alexander Lakhin <exclusion(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Avoid orphaned objects dependencies, take 3
Date: 2026-05-27 15:53:35
Message-ID: 3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ayush Tiwari 2026-05-27 16:00:07 Re: postgres_fdw, dblink: Validate use_scram_passthrough values
Previous Message Fujii Masao 2026-05-27 14:41:58 postgres_fdw, dblink: Validate use_scram_passthrough values