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 1wXKfx-003CVo-1u for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jun 2026 15:17:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXKfw-00CE9T-1i for pgsql-hackers@arkaria.postgresql.org; Wed, 10 Jun 2026 15:17:04 +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 1wXKfw-00CE9L-0W for pgsql-hackers@lists.postgresql.org; Wed, 10 Jun 2026 15:17:04 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXKft-00000002Lqb-2ipK for pgsql-hackers@lists.postgresql.org; Wed, 10 Jun 2026 15:17:03 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-490b8ac62baso54417855e9.0 for ; Wed, 10 Jun 2026 08:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781104619; x=1781709419; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rzaP3h03JXCPbiLQ5k3uIO9Hv3Dq8Cxj/P/NJKCVNU8=; b=eZFBc1frMDd4TrsADwpKes1XcgRpYTJEZROEUdh8eHyg/kFD0Fisx3TPjNh3PWStxF bWyMqo2HqxJLgVgMbS2Skg43Id1CqmyCZUCzWTAOvrTtRbHrz5soVLRYfaCOESnlt5A1 PYRu1ae/9ay9CN7hxwKlHbJQiAbmjJBJqbyVrXSTGDNRQBtg8JvAv6Lygmevi7K9xxft MY4HMrlJjjIFpQnYGUy94chLYml6+y3CUmV+3oTAnBYyp/MqNLRm7Iv+d4xfnzh0eC6x sNcqmsWqsAHGzWdOFUJWuGUR+eHOCF7T2MC97bwMzODvMOvHAH5v1xaAL3lG2NsFLKP4 OuLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781104619; x=1781709419; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rzaP3h03JXCPbiLQ5k3uIO9Hv3Dq8Cxj/P/NJKCVNU8=; b=qbc06bqHtyTT6XJST3iUUq4ljaWvx0yq56eU4aNXtazAdR9eya55b4eh+knGv8PA7w HoydtdEl9bqtux+o9kz++8bD3Ybe6a5M52pPjqVRqKqb1DWxi1SRjpX/OLdrpAsEPCVI 0fFEy1mahCmcodzcvOp0Dq1fUaV4ahthskwvKWRh7xG8QgxntGOLA12MmBfqcA3JZqQ4 afANQIjq5cENIkawMzJ/KfzJPWBrfyEbQiEYOllZjj6niqNseLmos0V8ZJ9Gzl5v4Mbt 0/uSfp525jzZgFNfcf+tzFvUHJM5oMAjSiWYZpMvRx1oLiFAqvI2MfTnhcE2u/7073I1 f6zQ== X-Forwarded-Encrypted: i=1; AFNElJ8BdvHQHkkhyB68fd681tGwVNOtgOWfCVEHdYzvk557OsyTM36mh1foSUEVSU1sitx2bfK8wIOkm3g3QsBy@lists.postgresql.org X-Gm-Message-State: AOJu0Yws1qflCOevMsLy/E+2tN/4FqRqhH1cKS560Tvs9SankrP8meDd jPlKDacTMpTVPeiu3aZaYZ7/jM3T0OHShWjGkDwJmu1AizMYn/U+up0/ X-Gm-Gg: Acq92OFaCfOCiWnhH8MrtLK18679eKAAqpwE4aUKHFgxpf4p4Psx8Uu2v345yvDOgJo gBwfEsnSnFqJNpDNZZH030XP6mDgGf7ABdWXSZhpKNeNy/5FoqZ/LzDA3QbhQvBVfaLGYbIyps3 a7U9PzfWKv7Jlr+lBoTxJBT/D5FJm6C+xThoeuT0mJzd4aGU7YxxES9PK5tcK+bkx5NEgh7MPg6 yTmJuc3eHfj/Yq1SRoF8QlULGqexy9Q+26I3ClrqWQoTKmLmGHlcMtt9BfS747rNpGGsEUXTGya piVm2tjwgFHwJPfpn13w8hNMUA2zN9IKUrTv+3Sspv5fQHkgAzBA05coRPtJ6C1tglNkk7yNGSK si5Ry2DC8aXnlXC1uw0OZzS4H7g7DzUWUUvdazoanESM0nJegMq8BDX2AQb60K1ZojaO9mw8SLe EPUf7ghqkjPyYKi3xV8/fgqyKsd2taVx94kJM0LTdaluEB+MhaHxNN/PJd17dEbTOwaZWGLY6Xa fURNrFOOWzrMx+gd4VTqg== X-Received: by 2002:a05:600c:4750:b0:490:9dc3:3483 with SMTP id 5b1f17b1804b1-490c2cb81fbmr295010335e9.2.1781104618640; Wed, 10 Jun 2026 08:16:58 -0700 (PDT) Received: from bdtpg (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f344541sm68094952f8f.22.2026.06.10.08.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 08:16:58 -0700 (PDT) Date: Wed, 10 Jun 2026 15:16:56 +0000 From: Bertrand Drouvot To: Jeff Davis Cc: Heikki Linnakangas , Robert Haas , Roman Eskin , Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane Subject: Re: Avoid orphaned objects dependencies, take 3 Message-ID: References: <3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi> <02e28438bd448ff4ee8f6fd78e6b74e657172d73.camel@j-davis.com> <71eb9a8835a28165939da567a9d649fe6d21bfa7.camel@j-davis.com> <0fc145b9b5cf3f59207cf4ca60270448a2891c46.camel@j-davis.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0a3rMzZuDzpUC49O" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0a3rMzZuDzpUC49O Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Wed, Jun 10, 2026 at 12:31:04PM +0000, Bertrand Drouvot wrote: > Hi, > > On Tue, Jun 09, 2026 at 02:44:10PM -0700, Jeff Davis wrote: > > Hi, > > > > On Tue, 2026-06-09 at 06:47 +0000, Bertrand Drouvot wrote: > > > In order to be on the safe side of things, the attached now iterates > > > through all > > > matching entries (and not only the last one). > > > > I don't think: > > > > if (context == PROCESS_UTILITY_TOPLEVEL) > > > > is quite right. > > > > In any case, I don't think mixing the tracking entries between entirely > > different DDL commands is a good idea. If you execute DDL inside of SPI > > in its own subtransaction, and it inserts a tracking entry to recheck > > something, and then you roll back the subxact, you don't want the > > tracking entry to then cause the outer transaction to fail. I didn't > > test this, so if there's something preventing this kind of problem, let > > me know. > > > > We probably need to track where we are in the stack of ProcessUtility() > > calls and keep the tracking entries separate, and always remove entries > > from that level on return (or rollback). > > I think you are right. I changed this in the attached so that aclcheck_tracked_count > is saved on entry and restored on return of each ProcessUtility call, so that each > nesting level's entries are kept separate. > > Also, the reset is now done whenever tracking is initialized (means at the > outermost ProcessUtility call that starts tracking). > > I think that addresses your concerns and it also fixes the issues reported > by the cfbot (that I mentioned up-thread). > > I also added more tests related to nested calls. PFA a new version of v26, it adds a new test as compared to the v26 previously shared. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --0a3rMzZuDzpUC49O Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v26-0001-Recheck-permissions-after-lock-acquisition-in-de.patch"