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.94.2) (envelope-from ) id 1t4mhF-002DWS-Ud for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Oct 2024 19:43:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t4mhD-00BO6A-PG for pgsql-hackers@arkaria.postgresql.org; Sat, 26 Oct 2024 19:43:36 +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.94.2) (envelope-from ) id 1t4mdt-00BGQ4-Bj for pgsql-hackers@lists.postgresql.org; Sat, 26 Oct 2024 19:40:09 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t4mdo-0038dK-JN for pgsql-hackers@postgresql.org; Sat, 26 Oct 2024 19:40:09 +0000 Received: from phl-compute-04.internal (phl-compute-04.phl.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 586A8114012E; Sat, 26 Oct 2024 15:40:02 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Sat, 26 Oct 2024 15:40:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1729971602; x= 1730058002; bh=ON1IC1m7uryan83aH34RjbGfapYU7rvCx49nnheHagg=; b=f V6vXcRqu92Whu9yMrD7G93FD7Me2/5lhghbnhsQbtejm3Ka1qswxcb4wCXXtGOM8 22p5LwphyINjT/WiZxeJBcj4qBv8s9kwyO/KEd9wNmUd8Ak0H27zLHNltwLZww8T WBQmMheNPvNx7MJEsxeMi42Ttn6LCEKODtdtZi0xXVFpwFpp+BdLYlFWun4T/ipv +MPN8T2br2xpDylOinozuboaS07L2kVf+pSNi4fFRpaedLrYf195xymTno+xICoD ZINarGWFAzEWMfLoM2EfmC3hWzM5T7mJvkWw+BYxGJCCY9UXKCkUK8hxEeEYBLZ7 X30MUnZVppAXajxek8DFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdejgedgudefkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdej necuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvh hhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheff hfejjefhgfeiueeukeejkeffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrh hprhhishgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspg hrtghpthhtohephedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepjhhgughrsegu rghlihgsohdrtghomhdprhgtphhtthhopegvgigtlhhushhiohhnsehgmhgrihhlrdgtoh hmpdhrtghpthhtohepthhnughrfigrnhhgsehgmhgrihhlrdgtohhmpdhrtghpthhtohep ghhuihhllhgruhhmvgeslhgvlhgrrhhgvgdrihhnfhhopdhrtghpthhtohepphhgshhqlh dqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 26 Oct 2024 15:40:01 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1729970934; bh=0lW3r9D0SD9i2kgTDXwY5FEWy8bFo32tgSwdjHgMq2M=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=iSAYEGnPnN0UbhpJI82ImmStWkcg7+53ah9ipHg+tRlQnOJrDJ1iGVYiJst85is/T z1Sd1DxM4EiZCYrdvUSTJ0E4EaIduD7tuxEC949fw5cQKZefDgE610iGsXY1FfBZS6 M1oDgWHiqCKl6MyBymm7Tt/mQrAKuAFYazx9sITIg28156EsrElU6wswNslEh9twUO 7Z0O9WR3F+nLO64sbvRIrtNwoYinFFum59ZumpTHoqJiiirtHcG9suIKbdkxaGMihN 4P8fZvCFCvRtI/uZkmBCt2o3PTCr7dsMEh6ADpmrrbdT4SdXGQiRJcXcuDRJ1/6SFz eLkMOjagPMN5A== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 348E612E; Sat, 26 Oct 2024 21:28:54 +0200 (CEST) Date: Sat, 26 Oct 2024 21:28:54 +0200 From: Alvaro Herrera To: Tender Wang Cc: Alexander Lakhin , Jehan-Guillaume de Rorthais , "pgsql-hackers@postgresql.org" , Guillaume Lelarge Subject: Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails Message-ID: <202410261928.cnrvrjbzx63y@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Oct-25, Tender Wang wrote: > When I debug codes, I find that the way to access AttrMap almost uses > "attrmp_ptr->attnums[offset]." > The codes now usually don't check if the offset is out of bounds, which > seems unsafe. > Can we wrap an access function? For example: > inline AttrNumber(attrmap_ptr, offset) > { > Assert(offset >= 0 && offset < attrmap_ptr->maplen); > return attrmap_ptr->attnums[offset]; > } I don't see any reason not to do this, though it's not directly related to the bugs in this thread. I encourage you to submit a patch, opening a new thread. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/