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 1rDmwJ-0038mJ-00 for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2023 14:43:51 +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 1rDmwH-008xME-Lq for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2023 14:43:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDmwH-008xM6-D5 for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2023 14:43:49 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rDmwF-00ANQk-1v for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2023 14:43:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 3BEEhjCb2781182; Thu, 14 Dec 2023 09:43:45 -0500 From: Tom Lane To: Richard Guo cc: rekgrpth@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18247: Integer overflow leads to negative width In-reply-to: References: <18247-11ac477f02954422@postgresql.org> Comments: In-reply-to Richard Guo message dated "Thu, 14 Dec 2023 18:34:44 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2781180.1702565025.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Thu, 14 Dec 2023 09:43:45 -0500 Message-ID: <2781181.1702565025@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Richard Guo writes: > On Thu, Dec 14, 2023 at 5:29 PM PG Bug reporting form < > noreply@postgresql.org> wrote: >> EXPLAIN SELECT * FROM t; >> QUERY PLAN >> ------------------------------------------------------------ >> Seq Scan on t (cost=0.00..10.00 rows=1 width=-2113929008) >> (1 row) > Can we just error out when an overflow occurs? Probably better to clamp tuple width estimates to MaxAllocSize. Anything larger would not correspond to reality anyhow. regards, tom lane