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 1syUPi-000GEq-GR for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Oct 2024 10:59:31 +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 1syUPh-000dUW-MY for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Oct 2024 10:59:30 +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 1syUPg-000dUM-Oj for pgsql-hackers@lists.postgresql.org; Wed, 09 Oct 2024 10:59:29 +0000 Received: from fhigh-a6-smtp.messagingengine.com ([103.168.172.157]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1syUPc-0008y7-Mk for pgsql-hackers@lists.postgresql.org; Wed, 09 Oct 2024 10:59:28 +0000 Received: from phl-compute-03.internal (phl-compute-03.phl.internal [10.202.2.43]) by mailfhigh.phl.internal (Postfix) with ESMTP id 5AB0B11402CE; Wed, 9 Oct 2024 06:59:23 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Wed, 09 Oct 2024 06:59:23 -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=fm2; t=1728471563; x= 1728557963; bh=ffGa5YPl1RCbdgZn/yYsHLszwsb1ijQnSm+l22nXHEk=; b=V l9MS4yJQ7aBaBpjboHFP87cYdrMp1RhAs2CSknQ3WbrNadv3AI+g0F3IEx6PpCeg sLuLtZVUa6cHNWWh1+mMzpKBtDj2BxKS8Do1De1jcy83zNBjChKsXIi3Ak3s0qYv ZBWwSWEWbyAhMf2YHPgaCuC+TLQhC3hfFwrCdnWksFqZivI6el+nt5itYsdlTy5p joKcZb9XqaN8GsJVT6p+qs1bOigo1tEgKt8O5SMFnMuiQoIHOk6GDP1aLsh3N1xm FnRtGSh0+9J3mPC0DbD2lou83apwiuQ/3laum03r6bnjB2RzuGcgjrnLinABThMj diDFMigjZdA7a6a9NeljA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdeffedgfeeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeen ucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffh jeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprh gtphhtthhopeefpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehjihgrnhdruhhn ihhvvghrshgrlhhithihsehgmhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhh grtghkvghrsheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgpdhrtghpthhtohep thhglhesshhsshdrphhghhdrphgrrdhush X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 9 Oct 2024 06:59:22 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1728471560; bh=iEUleuqrqM/eorjHoYQFaQ8Kr3MPAXNi2Vsr7AAm+IY=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=fm7cxGR6g4TUg1Y+cijZds4PoJelXmAa3arGIP1d7did6jhghMhTThBcEbYTS0Z2E uVRSbnbPU5D5ph64kD8FiV9l2nqM/5CUuJ5dan4fmSdxIk639N8AG4bN00kmluTv0n zDvfHi3xMJCQg1A8K7evpn0A06I3HGFlGPi2axrww75ZUCnVH2FRH8oUhHtVJbYTep amebc1JYfNYO2PIgMEGQ/ivnHQMBOadzMjsKL+K+j2DFdTDUBDEADX6oA4xI3pfcL4 6bNfhr6FL8gc+fRRNumzFqMJUCp6OeMftEReR8OJZkdnry+E3JIYKf94RFjnrx/Gt9 5AbE5U502SRjg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id C041BAC; Wed, 9 Oct 2024 12:59:20 +0200 (CEST) Date: Wed, 9 Oct 2024 12:59:20 +0200 From: Alvaro Herrera To: Tom Lane Cc: Pg Hackers , jian he Subject: Re: overflow bug for inhcounts Message-ID: <202410091059.oyl22p2w5kie@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1938142.1728406028@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-Oct-08, Tom Lane wrote: > Alvaro Herrera writes: > > ... This is because ColumnDef->inhcount is a 32-bit int, but > > Form_pg_attribute->attinhcount is int16, so we didn't break the overflow > > test for ColumnDef inhcount, but attinhcount has overflowed during > > assignment. > > Ugh ... somebody's ancient oversight there. Or maybe attinhcount > was once int32, and we narrowed it for space reasons? Yeah, both attinhcount and coninhcount were narrowed in 90189eefc1e1 during REL_16_STABLE development, so it's a relatively new problem. > > From branch master, I propose we change those two members to int16 > > (ColumnDef->inhcount and CookedConstraint->inhcount) to make those > > counters consistently use the same type; and then use > > pg_add_s16_overflow() instead of ++ for the increments, as in the > > attached patch. With this patch, the child table creation fails as > > expected ("too many inheritance parents"). > > +1. I didn't check if there were any other places to touch, but > this looks like a good solution for master. Thanks for looking. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "La conclusión que podemos sacar de esos estudios es que no podemos sacar ninguna conclusión de ellos" (Tanenbaum)