agora inbox for pgsql-hackers@postgresql.org  
help / color / mirror / Atom feed
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: David Geier <geidav.pg@gmail.com>
Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Reduce build times of pg_trgm GIN indexes
Date: Mon, 13 Apr 2026 11:04:09 +0000
Message-ID: <adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal> (raw)
In-Reply-To: <2a2f9cb0-f00d-413c-8517-4a3ad220d104@eisentraut.org>
References: <e5dd01c6-c469-405d-aea2-feca0b2dc34d@gmail.com>
	<2e11134f-02c3-43da-8c39-fb520a1a251d@iki.fi>
	<66620ec7-0f81-4813-9cf1-b901a56efcc3@gmail.com>
	<CAEze2WiUL9idZBbuUN+MuWqr6DcPr_-C91E9MTx=H62Xx5fHaQ@mail.gmail.com>
	<ef8782c9-68b7-4915-9f79-497765a8e205@gmail.com>
	<a90ebbbd-0d77-49c7-b222-3dbffa4e3b14@gmail.com>
	<2a76b5ef-4b12-4023-93a1-eed6e64968f3@gmail.com>
	<6439c655-e281-409d-b884-6586750d5820@iki.fi>
	<adeNWH5pDawDvvR2@ip-10-97-1-34.eu-west-3.compute.internal>
	<2a2f9cb0-f00d-413c-8517-4a3ad220d104@eisentraut.org>

Hi,

On Mon, Apr 13, 2026 at 11:41:02AM +0200, Peter Eisentraut wrote:
> On 09.04.26 13:28, Bertrand Drouvot wrote:
> > 
> > This commit makes use of StaticAssertStmt() that has been deprecated in
> > d50c86e74375. The attached, fixes it.
> 
> I think the position of the static assertion is correct, because it refers
> to the palloc0_array() that follows.  Maybe the comment could be a bit
> clearer, like "using palloc0_array requires GIN_CAT_NORM_KEY==0"?

Yeah that looks better to not lose the connection with palloc0_array() here.
Done that way in the attached and adding new braces to avoid warning from
-Wdeclaration-after-statement.

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachments:

  [text/x-diff] v2-0001-gin-change-remaining-StaticAssertStmt-to-StaticAs.patch (1.6K, ../adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal/2-v2-0001-gin-change-remaining-StaticAssertStmt-to-StaticAs.patch)
  download | inline diff:
From ebf2368d0620461c741d5fe5432f9856d0317848 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Mon, 13 Apr 2026 10:29:11 +0000
Subject: [PATCH v2] gin: change remaining StaticAssertStmt() to
 StaticAssertDecl()

d50c86e74375 added a comment mentioning that StaticAssertStmt is deprecated
but 6f5ad00ab763 made use of it.

Fixing by replacing the StaticAssertStmt() by StaticAssertDecl(). Adding
a comment to make it clear that this is connected to palloc0_array().
Add new braces to avoid warning from -Wdeclaration-after-statement.

Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2a2f9cb0-f00d-413c-8517-4a3ad220d104%40eisentraut.org
---
 src/backend/access/gin/ginutil.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
 100.0% src/backend/access/gin/

diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c
index d3351fbe8a3..76d162075a9 100644
--- a/src/backend/access/gin/ginutil.c
+++ b/src/backend/access/gin/ginutil.c
@@ -534,8 +534,11 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum,
 	/*
 	 * Create GinNullCategory representation.
 	 */
-	StaticAssertStmt(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0");
-	categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0));
+	{
+		/* Using palloc0_array requires GIN_CAT_NORM_KEY==0 */
+		StaticAssertDecl(GIN_CAT_NORM_KEY == 0, "Assuming GIN_CAT_NORM_KEY=0");
+		categories = palloc0_array(GinNullCategory, nentries + (hasNull ? 1 : 0));
+	}
 
 	/* Put back a NULL entry, if there were any */
 	if (hasNull)
-- 
2.34.1

view thread (51+ messages)  latest in thread

Message-ID: <adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal>
Permalink:  ../adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal/
Also on:    postgresql.org/message-id/adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bertranddrouvot.pg@gmail.com, peter@eisentraut.org, hlinnaka@iki.fi, geidav.pg@gmail.com, boekewurm+postgres@gmail.com
  Subject: Re: Reduce build times of pg_trgm GIN indexes
  In-Reply-To: <adzNqZdHrWHYCinj@ip-10-97-1-34.eu-west-3.compute.internal>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox