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 1wZISg-000vTR-2C for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 01:19:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wZISd-00EGhN-0m for pgsql-hackers@arkaria.postgresql.org; Tue, 16 Jun 2026 01:19:27 +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 1wZISc-00EGhF-2Y for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 01:19:26 +0000 Received: from mail-dl1-x122d.google.com ([2607:f8b0:4864:20::122d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wZISa-00000000cfH-23fG for pgsql-hackers@lists.postgresql.org; Tue, 16 Jun 2026 01:19:26 +0000 Received: by mail-dl1-x122d.google.com with SMTP id a92af1059eb24-13809223fd4so4257737c88.1 for ; Mon, 15 Jun 2026 18:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20251104.gappssmtp.com; s=20251104; t=1781572762; x=1782177562; 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=9GN0/ZaCu//y9lovHv5nN0beogngSygjs9f3cLYO9W4=; b=g0RxHojv0GAT+jUDBbsOS+Lj5xcGbaWdprQ7fOlHCY8wvYRB78rmzZlZScfRNkyF4u /GCXKWls5G14GrW+Gb0ibamOsAKhn3aBCHOo5aghTQOkoFutxsiuMoqiT3Kgv93URxLB ENG3N1gRHzjFaw0/H3gaF/Jxmp7tLzFTJkHkLH9OYuWAvrXU8C/TzUO7ceYkPq58TG5/ ect4LB1c4PBQZRXNlbDY+6io0glZDQWsDgNuFI78/ubI8goeqgiMKUlXdmpXWsigQyuZ qiHypcxYPLDSvCuK/bni9FY5HNgoS2qlBsfDhaLNEGpwdsifMAe7jZFL2qsWZIfnoteb CGJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781572762; x=1782177562; 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=9GN0/ZaCu//y9lovHv5nN0beogngSygjs9f3cLYO9W4=; b=YefNG3n7X4R2gikO6sNZJck5JzpdLIKkKn9cjB2Y5ylir9ws8D75BXYn9YLYesIyh1 nqeA5lpExrIy4WADuMP17vd9nIDBR7/BTqCvwRVocQLQjm4jrqPWo9YDoRX6PPvDz7xS zJf98rk8EAUo5WvF3We3A/Doj+NqFH8CyBWvTH26Ejbfj9cnjFXlPQGroM7bpBq/LiY9 C4jz2MK2PGX6dhgDRRp0JB50ic1IC4HKdGIpElzd3Bp6FrVLEDd0b+NBLNPX5IVst4Vm Hnrvwi8GUd/+SIPGWuTgSMJlM/vUHjbpEPRVlScdAeJf5hQNSaPppnytq60ExYKzBTpI WdrA== X-Forwarded-Encrypted: i=1; AFNElJ9rrCaXncipanNk9NGNkjo4RQn2V+jq8irDjY2xwrmnVN16O9Rq1NF2pTOrCh6shPJ+2kNX2ZRf0ZGGnByW@lists.postgresql.org X-Gm-Message-State: AOJu0YxWlCyLOxTEHiz08n3yQT+2oZCaiwqmAvS2c/Iqzc2jZyHGmoFl ruviuppJJZghIweGT3ynSSTLnQJxbd/Vy3Mg8RKAH+AGCDy7QrkYZct/G1o6nRwTNA== X-Gm-Gg: Acq92OEucFjlHHhqYN8olSicE7UoCFlF1drdU8gBuULFpfv7clWPj661VI4m1VOtMFo KuaPGWmxxWwjQvXs3WK3MZABsQ3Q38Gjz7xsv7929Ch1+IfBUOPofvHb+bteCepD/RF8uT6voxi Pbfci4+fRuDPg32teqx+24/IGmFiO2Iqm8lL4n76rF4ki3/Ig+F95EzfyYKmnR6afJXCukNKOQ+ atR7U4LG/z+FufjcwPlJBfqBkEyoY+H5hRYEwC28Ewe9LWGvkGkRvWTb9Ap9yjHsgMHk7XexvEA plwcn3D2/A3Us47jqThoTEWH3LBfWKIrrIQjtModGsfjLlgZWeWWtVmjwGK9JIQLRqwrEgzpOUH QLAkQEz2GIxAn/ty5gzskrwqrddURtmGMETBqkwSdRDfdKZxkL1o5kL4ZQJFXW8VkNqdC9EX4Yq 7a1uw/7Y0CflTNZXHdGBbl226Ygc9psfowyfd9HUlOGABK3lZ/4EvOO0YM X-Received: by 2002:a05:7022:1281:b0:136:959a:abf2 with SMTP id a92af1059eb24-13985ea8d27mr635752c88.2.1781572761850; Mon, 15 Jun 2026 18:19:21 -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-1384b916b2bsm11451424c88.6.2026.06.15.18.19.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 18:19:20 -0700 (PDT) Message-ID: Subject: Re: Avoid orphaned objects dependencies, take 3 From: Jeff Davis To: Bertrand Drouvot Cc: Heikki Linnakangas , Robert Haas , Roman Eskin , Michael Paquier , Alexander Lakhin , pgsql-hackers@lists.postgresql.org, Tom Lane Date: Mon, 15 Jun 2026 18:19:19 -0700 In-Reply-To: References: <3963e573-4852-4d25-b741-7c5c7e1f9140@iki.fi> <02e28438bd448ff4ee8f6fd78e6b74e657172d73.camel@j-davis.com> <71eb9a8835a28165939da567a9d649fe6d21bfa7.camel@j-davis.com> <0fc145b9b5cf3f59207cf4ca60270448a2891c46.camel@j-davis.com> 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 Wed, 2026-06-10 at 15:16 +0000, Bertrand Drouvot wrote: > PFA a new version of v26, it adds a new test as compared to the v26 > previously > shared. I'd like to avoid adding lines to AbortTransaction(). Also, I think it might miss subtransaction aborts, which could be relevant in complex cases with SPI. Can you use a structure like: ProcessUtility() { TrackAclTable *prevTrackAclTable =3D CurrentTrackAclTable; /* allocates in CurrentMemoryContext */ CurrentTrackAclTable =3D NewTrackAclTable(); PG_TRY(); { ... rest of ProcessUtility ... } PG_FINALLY(); { FreeTrackAclTable(CurrentTrackAclTable); CurrentTrackAclTable =3D prevTrackAclTable; } PG_END_TRY(); } That would avoid the need to create a special memory context; you could just repalloc() the chunk allocated for the table. It would also mean you don't have to track the stack frames manually with a counter, just use a local variable. Also, are you sure that the two call sites for aclcheck_track_record() are enough? Or do we need checks in e.g. pg_attribute_aclcheck() as well? Regards, Jeff Davis