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 1waZJv-001thN-1R for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 13:31:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1waZJu-00GMG8-0o for pgsql-hackers@arkaria.postgresql.org; Fri, 19 Jun 2026 13:31: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 1waZGl-00GIIs-1r for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 13:28:27 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1waZGi-00000001H1Z-47cP for pgsql-hackers@lists.postgresql.org; Fri, 19 Jun 2026 13:28:27 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-490aaeabdb4so12552835e9.1 for ; Fri, 19 Jun 2026 06:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781875704; x=1782480504; 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=0xl54lR7X2/v7TXaxwFZu2RrovZf9DJ5ZGoFMawcK2M=; b=pF6pv4jgfdF+tHycUJGCvCjmXyZZcs7y+FdNtBCqcV2gANIAWSmufS4iLl/KlOv3gF f9TyuKuQkKFnHaUVERkFm0JiQatpoKKfVWJb0hNS3O6JtnxAk18lcVoH4Hpw3hNCvtNk qSFnz7aN46pHMeHUCBRNyOocFzIQAX8COHFkhFUrsb6bNR7dso4kL6hdcvQIL4RjOBNy PrZwC3Ag2QmeDkss6gZPbsHNNkiBJtRHjZBDKitWKVDvi4Awakdu5j4IesEKg8kMkrgm IS5ERPpJtToNDlDPF+Kq12zpIoplDqVSz6axDVP2ZLHexk8Bwv9byGEOTdppg3Sc4rm7 STfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781875704; x=1782480504; 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=0xl54lR7X2/v7TXaxwFZu2RrovZf9DJ5ZGoFMawcK2M=; b=m54miSaGakEG5NaaRTd0gy5DNt/QOmjRVqjrim0wzsftM9AbsHOaJAZik+zJCkHyyc WJwepu/iX30XukxaNIE5vvgV1bbSxRFCW/ryz7KzoG4cJxAeBTcD1sm8GHxJz0RqW/7r 9GkgZB7veWJiXw9n598RrIafPNVxkYJPksXqbhKSoSuTiHorfzEELvBvqzqqvhUKPOz1 +KT7AtmpuMPW0dPiE4wlC43x2xAb2w4R2Wg7gsB3MQ7rQ7NgFe9lHF2QJZxZfFH4dPa9 HPlZHl1/5atAFMiddn9OZi81QYTas9vIRNERwmJq6Ha8HhKAnC1lmW7bTU531fN7fuU0 1sMA== X-Forwarded-Encrypted: i=1; AFNElJ/ArwiIzfFHw0FhPgkxV8CzB3naahxLxvGUBCX7Mf2Uwo0bn9r5FpXi78g/RALpnLJCJMLG119qE6kgfSqf@lists.postgresql.org X-Gm-Message-State: AOJu0YySWu6OFKO7YyE7LyGAEfrVYZ3SbwrY8WZoY1QSyNifMaIejN8s vjY0rP/mptvfhnOxRge+9aayjoAezb9x4FabLth1oaKruoxM7cB/KazH X-Gm-Gg: AfdE7cnl1S4wLJggkzyuPHUDhrVkM6i2fwT+frOuJ2CSIt9nBkuD+IKuHn6Bc7gafw5 nTV68NmzHhaqhzR600t9IBKzUxKNvmQu+3w/TGR0wzVEBFtzwYzsMfFiSQzdGVX2V9u+vDjv0c5 JbEw+eTFr0WNyJ3EgGvqqAVQBJcyzK7tZesDctga9WQgUdhczgccxI+B5ZJJvwyyMRiNx7aeLXp 8fCg+ZHTe4yIZ5QWyUKKU/1PfY3PDu3yg3ENcYR0WQlaAF6/UW5rf6UOOdhODv8ZlIRy+l3NZcq Pz2WTA5sE+grVVTfpzJTaN0M6PIji6yOly67AxdeFDNEbO6fV7QFbVFNFhAyUR1aAbuTx9CA+9+ gFXWXCQ8xyFlKqNSn+jiUhnVDMhbb+XEEDD03/0lDkKGb6ujfLd1mxgCyhdP0MUqWxH+s1pQU39 P82TYlOmBBp7iWs7mlI57WuyNVZE0x6dB4LltVuffdVX6RaK5JucYhqTqckTQG92eL9OdpZUhy X-Received: by 2002:a05:600c:a088:b0:491:9969:739d with SMTP id 5b1f17b1804b1-4923f5895f5mr67100685e9.29.1781875703487; Fri, 19 Jun 2026 06:28:23 -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 5b1f17b1804b1-4923fd21dbdsm65499155e9.6.2026.06.19.06.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jun 2026 06:28:23 -0700 (PDT) Date: Fri, 19 Jun 2026 13:28:21 +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: <71eb9a8835a28165939da567a9d649fe6d21bfa7.camel@j-davis.com> <0fc145b9b5cf3f59207cf4ca60270448a2891c46.camel@j-davis.com> <5591d661ea8189f5c057f6b48095f742e0d772f9.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5591d661ea8189f5c057f6b48095f742e0d772f9.camel@j-davis.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Jun 18, 2026 at 04:21:33PM -0700, Jeff Davis wrote: > On Wed, 2026-06-17 at 05:44 +0000, Bertrand Drouvot wrote: > > > IIUC, this is necessary for correctness. If an ACL failure doesn't > > > cause a transaction abort, then there's a danger that we cause the > > > transaction to fail that should have succeeded. > > > > Exactly, because we'd recheck an "harmless" failed ACL check and then > > produce > > an error. > > > > > So the ACL tracking needs to be precise: we can't track an ACL > > > check > > > unless a failure always causes transaction abort; and we must track > > > an > > > ACL check if it would cause a transaction abort. Right? > > > > I would say: we just need to track (and recheck) ACL checks that > > succeeded. > > IIUC, we cannot have false positives (tracking ACL checks that wouldn't > have caused an abort) nor can we have false negatives (missing an ACL > check that could cause an abort). Right. > It's hard for me to convince myself that we got all the cases right; > and if we have, that they won't be broken in the future. > > For instance, I just realized that something else I'm working on is > related: > > https://www.postgresql.org/message-id/5c629d2455946ad2fde3c184f64ea2c323ef2133.camel@j-davis.com > > It does an ACL check inside a subtransaction, where the parent > transaction is a DDL statement. It happens to be a DROP statement, so > it's not recording new dependencies, so I don't think it breaks your > tracking mechanism, but it's too close for comfort. I see, I don't think we have this pattern currently but yeah we may have it in the future (and our current tracking mechanism would probably fail in such a case). > We could keep the transaction ID in the tracking record, and ignore > entries from an aborted subxact. But it's getting fairly complex and > delicate. Agreed. We could use RegisterSubXactCallback to save/restore the entry count on subtransaction abort, but as you say it adds complexity. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com