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 1wVULp-001zxv-2x for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 13:12:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVULo-00CbaD-2Y for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jun 2026 13:12:40 +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 1wVULo-00Cba5-1f for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2026 13:12:40 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVULl-00000001QEU-49bl for pgsql-hackers@lists.postgresql.org; Fri, 05 Jun 2026 13:12:40 +0000 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-490be03d47bso15802715e9.0 for ; Fri, 05 Jun 2026 06:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780665156; x=1781269956; 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=WorgcXPJxEjwqo4FbUNNzDAJG82C/HW8O3vts5lDW+o=; b=IeOQD41sQETQ0xNdppHyvRZi6Tuom1kyp8LP3MrisVV5128ZQZo5Pwc0pLWqIEvhDv B/QA9gyYIAb9TRkAtaotGPGnRR13Mmpyi47hbdVzj2BaTyGEg/B01NYD10mNoSQVPdug J6X4ETKDAv7bb72WxnvJMr5PvD/nAWUUR6f6N2E0BxPisUXGdoyFxJirIbAkwlVzRALl 35wAUEZbdE2MFVMFlaNi+uPzVjqKKeLDm02MSDXoDKk45Xh1HgKDDTm7v1qH5smpcS6q 8tTOpjYl8Hws9EiGFu4v6XL1KMRxNHryVurLFzS62IvO2zN5NaM+cdS2x7wezOTMDDQI wAlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780665156; x=1781269956; 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=WorgcXPJxEjwqo4FbUNNzDAJG82C/HW8O3vts5lDW+o=; b=RK2VWWOO/R4JHJ3RmYS51Ym+/n69mnooI5au5jZuu0FvN+s6YZBojoLxgF4VOEZspJ 0ZStCmaJYiq8+r6MNeMnO9uqBh4wC1VRIxa4Wf1lS/qfD6+8wZHdZA71+BG5JeA6BGv4 8qBiAUQ/0kVruDdYX7kQjVfKQD8Fx6f2ZAE4GDZ4tlxNvLX0vleDFphbRaaPIES/ZZCd KMOJHtFuYp8fe3rIJg226X0Xx00cocE3SX4PKnil5k6aZHEn6G02XkZHO9kzm77huVtY 441pPgTF3PN6JpU/dqUhD1/0SgfW4HEgt5WknptvQlqigcdGYaH89EdlwbLueV+kxtSs /+ZA== X-Forwarded-Encrypted: i=1; AFNElJ+iEUYsru+dh+SGgDqPOrep7VgXhQ6wkIl6/CDCMNgjUwBDS5Vp1Cn2PKbwYbBLa3xK7mpr9j4mghSlWpnR@lists.postgresql.org X-Gm-Message-State: AOJu0YyShc+jgRvH6+/D6PpzR/sR0B3T4tVAoRSbiAh6bFhK3P/qd3sc t9uzqChOEqwuWc61Fsz8PqBj2m1nngd3yqeBDQb3hUJX1qHxNTcDqWdl X-Gm-Gg: Acq92OHPBvavruDrhhywWDVQ23XZXHp3gwFwXa0lbVpg4enBii4YhjKi9ipyUg7EPpk HxoVJYlR0GdRHUZNkkS4Yu2GG9Q4XgoW9dhaio66VTurxyJiJjihHcivnqkr4apFHoj0yMrLjg0 Ak7fTdWt5xKpfR/cj86diX8TntObo13u0sZTitGlSNUDkncALy5PO/hfiavD4NW+EY0dR01Tv2B mZ1OClTw7accITfT2XW1zfvA2+HZ0KBh/4ENXRumqcHKqP6ztjNQpkyRtZhap2cDDg3PYZaecOk fFTup0wd29q1dCphl8IA6/chK8+ZEw9PlAK8FHqO0nMeu8nUopUy94ysU7gr0oVgvLMmvHuxr4M V3IgaIF4XszdNT45XriwiIIutGyZwQ3ZNhMAen7SS7bUpd7AaWp5rK04MKlxhJNpt78+y2qBCCU P+4kN+dOCH+XEUogrwqm12zVFgssn3NMGCz8YDyzWpnMj0W3l4oBxxY0Qj7XGpyAe1jzkg2SrKi kko2t+HSkr2bigWr1F0mQ== X-Received: by 2002:a05:600d:8494:10b0:490:c2a3:3304 with SMTP id 5b1f17b1804b1-490c2a333c7mr34271925e9.35.1780665156414; Fri, 05 Jun 2026 06:12:36 -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-490c2c9ebeesm38947415e9.0.2026.06.05.06.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jun 2026 06:12:35 -0700 (PDT) Date: Fri, 5 Jun 2026 13:12:34 +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> <5315d15a42109297259d1a3264ad09e363eb98df.camel@j-davis.com> <44220da166d8f1ef74b2bf76c60a7663dcf9dc07.camel@j-davis.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44220da166d8f1ef74b2bf76c60a7663dcf9dc07.camel@j-davis.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Thu, Jun 04, 2026 at 10:17:57AM -0700, Jeff Davis wrote: > Given that we don't do another name lookup, the object Oid doesn't > change, and it's not obvious why we need a loop in this path. > > A sequence like: > > Earlier during DDL processing: > 0. Name lookup and ACL check (and track ACLs) > > When recording dependencies: > 1. Lock object > 2. Check that it still exists, error if not > 3. recheck tracked ACLs, error if failure > > could work too, right? Yeah, that's a good point, thanks! > I see why you might want to do the checks while not holding the lock, > but it doesn't seem like a requirement (if the user doesn't have > permissions it should fail quickly and release). I agree that we can get rid of the loop and that's what v24 shared up-thread [1] is now implementing. The downside is that one could take a lock on an object he has no privileges on but then, as you said, it will be released shortly after. [1]: https://postgr.es/m/aiLKkTC6QBt8i35P%40bdtpg Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com