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 1wDNrF-002ua6-2R for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Apr 2026 14:38:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wDNrE-005r63-2V for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Apr 2026 14:38:16 +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 1wDNrE-005r5v-1W for pgsql-hackers@lists.postgresql.org; Thu, 16 Apr 2026 14:38:16 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wDNr8-00000001Pxz-3jRy for pgsql-hackers@postgresql.org; Thu, 16 Apr 2026 14:38:16 +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 63GEbpVB2340005; Thu, 16 Apr 2026 10:37:52 -0400 From: Tom Lane To: Heikki Linnakangas cc: Peter Eisentraut , David Geier , Matthias van de Meent , pgsql-hackers Subject: Re: Reduce build times of pg_trgm GIN indexes In-reply-to: <99ce20a5-793a-4182-9120-f274fbef9bfd@iki.fi> 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> <2197023.1776288324@sss.pgh.pa.us> <4c1f88d7-5102-45b3-94e3-86d7e4b46b0a@eisentraut.org> <99ce20a5-793a-4182-9120-f274fbef9bfd@iki.fi> Comments: In-reply-to Heikki Linnakangas message dated "Thu, 16 Apr 2026 12:49:38 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2340003.1776350271.1@sss.pgh.pa.us> Date: Thu, 16 Apr 2026 10:37:51 -0400 Message-ID: <2340004.1776350271@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Heikki Linnakangas writes: > On 16/04/2026 11:45, Peter Eisentraut wrote: >> What I'm missing here is, essentially where the previous thread stopped: >> What is the overall message that we want to communicate with the API? Good point. >> If the default assumption is that what pointers converted to Datums >> point to should not be modified on the other side (where the Datum is >> converted back to a pointer), then the current declaration of >> PointerGetDatum() is suitable, and the GIN code can be considered an >> exception and we make a special API for that. The previous thread >> proposed NonconstPointerGetDatum(). I think there can be no doubt that most functions receiving a pass-by-ref Datum are not supposed to scribble on the pointed-to data. So it makes sense to me that PointerGetDatum should carry an implication of const-ness, and then we need to invent a new notation to use in the small number of places where that's not appropriate. I'd capitalize it as NonConstPointerGetDatum, but other than that nit that naming suggestion seems fine to me. Of course, then the *real* question is why DatumGetPointer doesn't deliver a const pointer. But I don't see how to get there without extremely invasive changes. > We could have all three: Not excited about making massive changes for this. I remain far less certain than Peter is that this discussion has anything to do with why Coverity is complaining about ginExtractEntries. I still think we should make some minimum-effort change to see if the complaint goes away before expending a lot of brain cells on choosing a final fix. regards, tom lane