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 1wVBTg-001lTZ-1Y for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 17:03:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wVBTf-0080Zl-17 for pgsql-hackers@arkaria.postgresql.org; Thu, 04 Jun 2026 17:03:31 +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 1wVBTe-0080Zd-32 for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 17:03:31 +0000 Received: from mail-dl1-x122e.google.com ([2607:f8b0:4864:20::122e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wVBTc-00000001H7C-21gt for pgsql-hackers@lists.postgresql.org; Thu, 04 Jun 2026 17:03:30 +0000 Received: by mail-dl1-x122e.google.com with SMTP id a92af1059eb24-137e75bcb5eso1627325c88.1 for ; Thu, 04 Jun 2026 10:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20251104.gappssmtp.com; s=20251104; t=1780592606; x=1781197406; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=6xBy9hvdQsvUnUIaqsMoNSd9VjRCKkJ01bA/VbvMcfs=; b=BbzJ5R2Fo0eHA8hLfvstY4tsHA5C3p5hJ+qMtnS0Nxb/MRPKkgiK7MV/DiPFqiDFOU hQ0xAG156nNQXCSMMV4S2Mi92xChgdD0WEHEnb2e9hO5EUFSPw5tkw7qzWQIwBHQP5sK Szj8y6o176Y++3x3347Wsb8KnvodvYG0N4wPGIT99TB8Eu42I3K8A7VoeCnbZWWV1nmi IuzVARqX7rVBo5Cr9op5i0cjv2gX2SKcFMXUaqmJ/vewxy097YeEOz0nLFPlaHBoJhSP peTneLtBIVFgu3A/S6Mh6XOh1jBylycQyKA845GvIbgoD2MyKGz4xStsb4m0OZOyZyO+ 3jbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780592606; x=1781197406; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6xBy9hvdQsvUnUIaqsMoNSd9VjRCKkJ01bA/VbvMcfs=; b=FkJqGFI807hZ9kLx/dJqzUOQ3yhUu7/ql9ZW2gl5PYKDBd7f+xivXuw+/BL9b5/ROD ZURb9IOltki3exb1s4b8yL4rhoB/c6/qLRK0D5MECHlZYNnFRY0iP32j9Meg1HbUMX71 w/Spv6dDB2Cb7wIqZFX+cKRLxdfqVMDto0PZaHZBhpl2PhUkQ7xlSeftbKVhA3cT/Z7+ AozzkC5I/rHnA9m0ZQbYWrMMbu7L5I8Or+Yg9O5AmR8xR6ZNRPTNdzU5DPWzBc8uLocP WhV4xwYHlEZ46oaReViiSn/5YZX9UP/q4AuvXrdAb4LxjoBlgUUrLeEoY//2epfy1I/C uRxQ== X-Forwarded-Encrypted: i=1; AFNElJ8oiGbsVe1t+bLrvTAv2Hy344sUrexubTbyBq9LCTJ91/otBthDUdFQw7Zws3waHzDnmQG/sFtIFw2ZqnQj@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0OHh8l7CFLLZdJWil3w5hEkcJ54FqGag6Kc6cXho/LW6WDsNi 1xPQP2zB5BhD4H/7g+pdw0HfIHwRJ1y4rdvhjUTOuvwktKWlrCUu66riPGJDDSWiyw== X-Gm-Gg: Acq92OFeCS2rXmhjmadv5MlqCH0U5tRZgxE92Dtlj9i9yWY/BeAAMQzLwCnG8tfvYH7 HPR+pJppK8NDSCcOiL06nl45Mm7DJpG0D2qf/hSA8TNZoMGfjgJ57CWOYTCDfRoPjZ5Ofbd5br5 SdGppOx0ML4F2A3Z9gBJ1Q47OZ2QHrOq8yUvrGhdLZywjmAixwUnVAE7Cc64BVX0qMP1iL1LM3f B6xDDw9qD9mumdwarpEpgG5VnKUBXlwE2JntOZJmI2N9lkautsVeyLswUDbx6/Pgybxab9BpadE MAasrA+g0koIGVs90ftWQkZIIyzrz6WYmBHDtpvrLp8PmD3GZSntZgsjWWYkn+WzQW4wJ1M/A96 73D+hUP4on7APCcGSLYU536UkSy+NwqJVTJQ+XLn+JGuYGgbNNlBj8cN+Rc8ZSVG+VzRoC9ge0T 8StRc2taQLf8TNDUjw3joSBRrdit1ZF5xHpyovIilGHVICOlQ7TIBfqLIzi0HsSi8Li1A= X-Received: by 2002:a05:7022:2390:b0:135:e312:47a4 with SMTP id a92af1059eb24-137f69382a9mr3630389c88.9.1780592605268; Thu, 04 Jun 2026 10:03:25 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-137f716017esm5427820c88.15.2026.06.04.10.03.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2026 10:03:23 -0700 (PDT) Message-ID: <02e28438bd448ff4ee8f6fd78e6b74e657172d73.camel@j-davis.com> Subject: Re: Avoid orphaned objects dependencies, take 3 From: Jeff Davis To: Bertrand Drouvot , Heikki Linnakangas Cc: Robert Haas , Roman Eskin , Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane Date: Thu, 04 Jun 2026 10:03:22 -0700 In-Reply-To: References: <9f5f0dd4-96d5-4d90-9436-62d96e0298f9@arenadata.io> <3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2026-06-01 at 09:21 +0000, Bertrand Drouvot wrote: > The tracking array lives in a dedicated AclCheckTrackContext memory > context > (child of TopMemoryContext). The context is reset at the start of > each > top-level utility statement, which frees all prior allocations and > provides > clean lifetime management. >=20 > Recording is gated by aclcheck_tracking_active, which is set to true > only > during top-level utility statement execution. This ensures DML and > queries pay > no cost. The flag is cleared both at normal completion of > ProcessUtility and in > AbortTransaction to handle the error path. This could use some better high-level comments in the code. Something like: "DDL performs ACL checks on referenced objects before acquiring a lock on them. The lock is acquired much later, when recording dependencies. Track the ACL checks, so that we can re-check them after acquiring the lock. XXX: consider refactoring so that we perform the name lookup, acquire the lock, and check ACLs all in unison, like RangeVarGetRelidExtended()." Assuming I understand correctly. Regards, Jeff Davis