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 1wD5fb-002b9d-2M for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 19:13:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wD5fZ-001cRJ-1v for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2026 19:13:01 +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 1wD5fY-001cRB-2L for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2026 19:13:01 +0000 Received: from fhigh-b3-smtp.messagingengine.com ([202.12.124.154]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wD5fV-00000001H3u-3Vey for pgsql-hackers@postgresql.org; Wed, 15 Apr 2026 19:13:00 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 4F96F7A00F0; Wed, 15 Apr 2026 15:12:54 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Wed, 15 Apr 2026 15:12:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm1; t=1776280374; x=1776366774; bh=qctGo+G/7rbdYZB85HIogZ/i+v95z3zH RkEtkoTJlEE=; b=NSTTpM/1SSfu3Dxz2NmK86BJkjM4ZIpS8v3IG/kYFu2EZRAB eU9CxXNDBF00mGLVQUAUthdgLJAUzVVvUjz5yar72WNxjOChupEJfXbHEqsW6xC0 urUOz9vx/Mg/oQGDVoFZT/QXVMVCSLosKhWqSvSIg74moGtV2m3oH5GTlWFsaImn T0XmvmRtSVxqXtNOgenpb3oshB98LGz0z84PXOceubMKOGPBm71zEXW1cWkrEBbd Gas373m5RIVKybBRHUYI2VhR2FV04n9WUkG7VFdAm1IK48i9dgAHYsuaBUI/ZXG5 lcYrz+Dr+fVYEN8i/YkcbDnPTdO3M6oLnf8zPA== 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 :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1776280374; x= 1776366774; bh=qctGo+G/7rbdYZB85HIogZ/i+v95z3zHRkEtkoTJlEE=; b=F TJE7Xsmu9ZwLVyxMzU6YOjsAUxyy9pe6N3H8bRObwwmhA26fWYCGOLjW2pOaKfDy jeg+bbPFBcXrtOtfxx2vtztk4wF0aMEnlU3Fq7BXx2OeWtYKtO3ki6++Py5rXM5h 7RBrN6a/EVQR0fq+wGcUBSkgVSPi6CRtQ8TiKPliOTnrEMTpcN/hCZ6mdg0t6ito D2WLncVb7Bc0zdAy/N6MsvTaIcL2ixXN/TSHyd+ct84GDU1G9uI4e4VyTvrTJJ4g EGezDEs2Zx7s2chTib0MmArtom89RanL6LLTCRHX4kmrA2rcfGVKWN5YbDeqbvFp dgijVgr9883gf/GliX3AA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdeggeeludcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeejhfevhedttefgfffhhfeffefggffhffelgfeiueeukeehvdeh vdefheffvdefueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohep hedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohephhhlihhnnhgrkhgrsehikhhird hfihdprhgtphhtthhopehgvghiuggrvhdrphhgsehgmhgrihhlrdgtohhmpdhrtghpthht ohepthhglhesshhsshdrphhghhdrphgrrdhushdprhgtphhtthhopegsohgvkhgvfihurh hmodhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhh rggtkhgvrhhssehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Apr 2026 15:12:52 -0400 (EDT) Message-ID: Date: Wed, 15 Apr 2026 21:12:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Reduce build times of pg_trgm GIN indexes To: Heikki Linnakangas , David Geier , Tom Lane Cc: Matthias van de Meent , pgsql-hackers References: <5d366878-2007-4d31-861e-19294b7a583b@gmail.com> <9ac3931a-180e-4283-a7a8-05eb66099206@iki.fi> <2e11134f-02c3-43da-8c39-fb520a1a251d@iki.fi> <66620ec7-0f81-4813-9cf1-b901a56efcc3@gmail.com> <2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com> <6439c655-e281-409d-b884-6586750d5820@iki.fi> <342012.1776017102@sss.pgh.pa.us> <8f3fab0e-02e1-4948-9683-224fe54e30ae@iki.fi> <77cc23dd-ac53-4bb9-9e90-0019c9ff58df@gmail.com> <195097d6-64cd-4adb-b8a3-1d86ae31c411@iki.fi> Content-Language: en-US From: Peter Eisentraut In-Reply-To: <195097d6-64cd-4adb-b8a3-1d86ae31c411@iki.fi> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 15.04.26 13:06, Heikki Linnakangas wrote: > On 14/04/2026 10:02, David Geier wrote: >>> I didn't do it for performance, but because I find the function easier >>> to read that way. We could change it back. >>> >>> It's a pretty scary thought that a compiler might misoptimize that >>> though. In the same function we have 'nullFlags', too, as a local >>> variable, even before this commit. Not sure why Coverity doesn't >>> complain about that. >>> >>>> /* >>>>   * PointerGetDatum >>>>   *        Returns datum representation for a pointer. >>>>   */ >>>> static inline Datum >>>> PointerGetDatum(const void *X) >>>> { >>>>      return (Datum) (uintptr_t) X; >>>> } >>> >>> Hmm, is that 'const' incorrect? This function doesn't modify *X, but the >>> resulting address will be used to modify it. Maybe changing it to non- >>> const "void *X" would give Coverity a hint. > > This was briefly discussed when PointerGetDatum() was changed from a > macro to a static inline function [1]. On that email, Peter pointed out > that the compiler was doing the same deduction that Coverity did now, > i.e. that if you pass the Datum returned by PointerGetDatum(&foo) to a > function, it cannot change *foo. I'm surprised we dismissed that worry > so quickly. If the compiler optimizes based on that assumption, you can > get incorrect code. I don't think this is in evidence. AFAICT, it's just Coverity that is complaining here, which is its right, but the code is not incorrect.