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 1sHbd9-009YTJ-Ep for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jun 2024 04:00:07 +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 1sHbd7-00Caop-7I for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jun 2024 04:00:06 +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 1sHbd6-00Caog-To for pgsql-hackers@lists.postgresql.org; Thu, 13 Jun 2024 04:00:05 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sHbd5-001P7e-Fp for pgsql-hackers@lists.postgresql.org; Thu, 13 Jun 2024 04:00:05 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52bc1261e8fso703439e87.0 for ; Wed, 12 Jun 2024 21:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718251202; x=1718856002; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=NDIVTFeuNDHVp2IAo6pQiS+sUiyqJ+s0XMdi8cviiEs=; b=f//7IhlyNVWXcQvgUekjsa7+jTFbnMavGAy/82xYMMSkjWPOpf0GhNGxeKWNMmp44z 8Bc157yi/JDJDrOjplRw6mFH8yk62mlDmd9qFS8FuCpxQvYXllG69IrrB0cDPS1Z7c9e VL6d0FIJlze/5PgGIGzpk9nc7mh1i/NSskiAnkWMu38R5iDv8Y2d46Qd4qYciwshvogq AjbELDhb65JlCiIV+44tK4bbthhinsDYsTQqqw1BGaz2HnUWnApzEMFBLdWZ1J9vNJWF 0LwLqZnAjtEDIr/r4Anjb4C7PFvgpSuo5y+foHrcTbhcW5H3+o8J4ZS4jWnWPpEJNLz7 KEHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718251202; x=1718856002; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NDIVTFeuNDHVp2IAo6pQiS+sUiyqJ+s0XMdi8cviiEs=; b=om+aEKL7lP8gJaoGXMIJe/N5IJ7Q8dN7VcKA4cO6VdrluDQFCXEQrd35youGmH5agu 6ESVlxcdjFOjAb/9qRW7AYyb4AUog37yuU3Hgoem/3t2sGdIsBhBUIH3wfoCB4UpMJQ6 w69m9WdCQQn2x2EBnE7Ec8FORp4m0qO0Nj1YX46Ci725O2GuNjHmsEFn2Vsj8FGHxPoY 2jUAlWQknLytiM0kGUnnPGyHihhrA2B5WwW13FRCb1cKziJxdvCqZdSPkVTc90ywSIyl 7JiLrCPyXyQJoJVJ4s/+n7ezFQ1YwwlSEX9vR0Q6Dm1jhZxcg5pVOJtGlR/WYNQ8vw8L lQNA== X-Gm-Message-State: AOJu0YxlcZ+W8C71QS1nNwyLaDqGrPd76zz51zjL1D+CiT3bTB20378b APq7X5dDeG1AeuCmVomvL6SRnSjIsR8hQe2PA5emGoIn72dpKrC5 X-Google-Smtp-Source: AGHT+IHoPvD4wDcImjOjkPHpBQmMyquseqid1PhveyX7DyB76Q9vjNugIdQFhCNR2YlbJm6UxW6eyw== X-Received: by 2002:a05:6512:108e:b0:52c:7f12:61d1 with SMTP id 2adb3069b0e04-52c9a3b972dmr2981051e87.1.1718251201750; Wed, 12 Jun 2024 21:00:01 -0700 (PDT) Received: from [1.0.0.7] ([178.155.25.76]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca287aed3sm68719e87.215.2024.06.12.21.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Jun 2024 21:00:01 -0700 (PDT) Message-ID: <31ad2cd1-db94-bdb3-f91a-65ffdb4bef95@gmail.com> Date: Thu, 13 Jun 2024 07:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Remove dependence on integer wrapping Content-Language: en-US To: Tom Lane , Joseph Koshakow Cc: PostgreSQL Hackers , Andres Freund , Nathan Bossart References: <618777.1717984674@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <618777.1717984674@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 10.06.2024 04:57, Tom Lane wrote: > BTW, while I approve of trying to get rid of our need for -fwrapv, > I'm quite scared of actually doing it. Whatever cases you may have > discovered by running the regression tests will be at best the > tip of the iceberg. Is there any chance of using static analysis > to find all the places of concern? Let me remind you of bug #18240. Yes, that was about float8, but with -ftrapv we can get into the trap with: SELECT 1_000_000_000::money * 1_000_000_000::int; server closed the connection unexpectedly Also there are several trap-producing cases with date types: SELECT to_date('100000000', 'CC'); SELECT to_timestamp('1000000000,999', 'Y,YYY'); SELECT make_date(-2147483648, 1, 1); And one more with array... CREATE TABLE t (ia int[]); INSERT INTO t(ia[2147483647:2147483647]) VALUES ('{}'); I think it's not the whole iceberg too. Best regards, Alexander