Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSGZk-0034fg-0k for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 15:53:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wSGZh-008edo-0c for pgsql-hackers@arkaria.postgresql.org; Wed, 27 May 2026 15:53:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wSGZg-008edf-2c for pgsql-hackers@lists.postgresql.org; Wed, 27 May 2026 15:53:41 +0000 Received: from meesny.iki.fi ([195.140.195.201]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wSGZf-00000001iRt-3SVo for pgsql-hackers@lists.postgresql.org; Wed, 27 May 2026 15:53:41 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 4gQZ0c5LCyzyZ3; Wed, 27 May 2026 18:53:36 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1779897217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SyleXZ+Y8/mLZRPQeVqpfPuv/60rGhZV93qYxBOH4Qk=; b=LkWfX2EpYHvkNEhUNnrCbs8bE/3z88JJUnNWN5+TAdSnNDn4+tit94iWoTma+IHD7OJ7HW ki2TXwI/AyLlN/14nWavoNIp+dYMIVzcqJTrjKPguYf02QcfRtOemetOLxAJbbWtP9BvJS 4cU0yxVSCDMXmmK04oBE/qqWP1AI8Ys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1779897217; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SyleXZ+Y8/mLZRPQeVqpfPuv/60rGhZV93qYxBOH4Qk=; b=izvMYaa0IOo+wGqjP33K442XZwZHNBzdNWlXPDTLLqPPpjZAkhEzc3oQTxRETaXHRkU0AH KVRm1mcVCkJ1we0AwPxJG8X6y6J3yS1t65/vT3UGPExhlEAHhnYUMNAhJ4RGkit8Hnsa6A gkfaSl826RfJWF8wGiwa0mucGJ0S+xM= ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=meesny; cv=none; t=1779897217; b=WF4qKqd1IG5uyHHvq1krwVG82Ueb5DdFg4cnd1Mk18ZfL/u2hgFhKf2CWUVuIAGj/ZI2ey 6ZbxweFnxQZJaszUa/xhKRXzjbg9yCXRw2aP4nTFcNvU6bCxWIzfFxl7jDXkSI+TDmglLP D+4U3FOuMX+sggh4DVL+4E9rHRhgNN4= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: <3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi> Date: Wed, 27 May 2026 18:53:35 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Avoid orphaned objects dependencies, take 3 To: Bertrand Drouvot Cc: Robert Haas , Jeff Davis , Roman Eskin , Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane References: <9f5f0dd4-96d5-4d90-9436-62d96e0298f9@arenadata.io> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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