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 1vkIAa-00DBrN-1x for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jan 2026 08:42:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vkIAZ-006x8I-0h for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Jan 2026 08:41:59 +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.96) (envelope-from ) id 1vkIAY-006x89-2x for pgsql-hackers@lists.postgresql.org; Mon, 26 Jan 2026 08:41:59 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vkIAW-002MaO-1n for pgsql-hackers@lists.postgresql.org; Mon, 26 Jan 2026 08:41:58 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-47edd9024b1so34248805e9.3 for ; Mon, 26 Jan 2026 00:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769416916; x=1770021716; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=HAY+pgmGo/Wiqq/9DrcMmucSoMQMNfBgP+HjyYtyFss=; b=A1LSFOJ/DN0sQPqOkQ5QGO827Ls3ZTANYk0U/22d3D7u8JWkD8e+e7oWY8atBBWyS5 lY7Ip6p+b2eSMfSzeGlBBnns38ENLnitXL5rsbWfvcrZLs44UzUvkg5kLMM3ZjVdI9au /cYt9SrGzO71V8iBtD51VOfWBuzT41C7pte4jRrYZpmFbTNPJCVK+00EySW+RrsbJFGt OKarhYn4n+jojOxxhd0SUuDfCCnbQ+CWS/OHNl/mnbIb8HGB4Sy2UOUUZ/grKfOn9wLt DS5lgF9/EEtepp6eaH6IvNckVfwwVTQyHB0XyswqDVvXAPGn34FfX5Hd88A1DVDvHUXm bfDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769416916; x=1770021716; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HAY+pgmGo/Wiqq/9DrcMmucSoMQMNfBgP+HjyYtyFss=; b=cWHC1LrECcOCkYNKaNUtdmLpN1gVtWQgMVW2dJ3jv1pA8om1Qwkb7h2sWQFqzv790Z QDOvyV5Kge3qa9Bz+xmwxQoBP/GRF9VHuQJFTT/2W9AyGmAF2w0+2kr9F/ACcyNX235h f2WrSNIPDKaFvYaN5bz5LzerFrVUmnn6S3e3DwSbjT0fMVCLOYZ9pXSujEGTBJNth7hb G/jEBAe9Xp/lTQgP7ehNIvAyoIDwe7EDRUrBTQzIxqyNoURZ6OLJ7BjimvcriYnfyenC wCKmyBGdRALtJ2zbzTyeGxjZHX4ZYOMOS6eMrK7Vzyy+8llMGlpv3gdNk0FcSrIKjmla 97kw== X-Forwarded-Encrypted: i=1; AJvYcCVCqMseb8dx3/aZqQEaAEZy5JlTPehoKcW68eE7ZgUROhvcUVWQsryJP2+p9BOOjGmQRSTVSvnqvELhrJE2@lists.postgresql.org X-Gm-Message-State: AOJu0YzKSLUuMYUANJkE8wj5sUpQ++deXCKpzmwxby+M3x+fv7U9lc55 YFkF+8kHdvLYQkMDG3i97vnNxQpvMiLsWX4KzS7A4U3Tzox2CTfsVJv5 X-Gm-Gg: AZuq6aKiuo4ed9qm5fE6euwRMsVls0v4i1nyAAx4MUWS/BBi7fASoKQh6hisFo+alwJ pbJxjawjaCbUaP/Crd2uzlLGjvxAwLF06BV9WeKtl+UjoZCE+0BjwgG/j1HJO/pHmVv2SqdBcIS /js1kM21yOBHEOKvqPxhxA6AuSaoQwPmkeyFz881Qv4MUmI6JtKrpHHsw7eQpWWtXnNKUzMCaVB ebulvocZKqCRwm82bhEFC4tZ78ukUb6n62mU6M9tOW/lZofj6AeNNxGn7MBQroQKJYlAGG6gmaV qeTcsFzqhUYtKxhnkl/E1P8KoJwKRJC2YG9TLYLWwfEsBXXJr/T2NJRV6Z7Gf/7zo0SbvakGKs4 qjjyrTlHvJ8tH2VPR8+e7RgfbdSh8+d0zZ3dtH8DWF5wRsDSRb3ucoOXkm5kHrUCiRKhYfSLGEX aZadBv81qajBWi1g9I+mgYtxwg10xOEV9YaBX88Pt+8ftJLfVOEhUqcNpNqqLGjYCn43rGCz6s9 Nmovg5XFQU0oG2vHLhyfqsAruL2zP+qNri/gzNVi9YurQ== X-Received: by 2002:a05:600c:198a:b0:46e:4a13:e6c6 with SMTP id 5b1f17b1804b1-4805cf5ee3fmr59021055e9.19.1769416915591; Mon, 26 Jan 2026 00:41:55 -0800 (PST) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-197-144.eu-west-3.compute.amazonaws.com. [15.237.197.144]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804d85cff5sm261140585e9.7.2026.01.26.00.41.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 00:41:55 -0800 (PST) Date: Mon, 26 Jan 2026 08:41:53 +0000 From: Bertrand Drouvot To: Jelte Fennema-Nio Cc: Thomas Munro , pgsql-hackers@lists.postgresql.org Subject: Re: Safer hash table initialization macro Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Jan 26, 2026 at 12:38:15AM +0100, Jelte Fennema-Nio wrote: > On Wed Jan 14, 2026 at 9:46 AM CET, Jelte Fennema-Nio wrote: > > Changed wording and changed to NOTE. > > Attached is v7 which is rebased and changed the hash_create calls > introduced by 282b1cde9de. Thanks! The changes make sense to me. Just a pgindent nit, in 0003: $ git diff diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 73f93512f9b..0a1e7c709c9 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -3162,8 +3162,8 @@ AddEventToPendingNotifies(Notification *n) Assert(pendingNotifies->uniqueChannelHash == NULL); pendingNotifies->uniqueChannelHash = hash_make_cxt(ChannelName, channel, "Pending Notify Channel Names", - 64L, - CurTransactionContext); + 64L, + CurTransactionContext); Also, I can see (I think it's coming from 0004): In file included from ../../../../src/include/access/hash.h:28, from typcache.c:46: typcache.c: In function ‘TypeCacheRelCallback’: typcache.c:2472:46: warning: declaration of ‘typentry’ shadows a previous local [-Wshadow=compatible-local] 2472 | foreach_hash(TypeCacheEntry, typentry, TypeCacheHash) | ^~~~~~~~ ../../../../src/include/utils/hsearch.h:314:20: note: in definition of macro ‘foreach_hash’ 314 | for (type *var = NULL, *var##__outerloop = (type *) 1; \ | ^~~ typcache.c:2412:25: note: shadowed declaration is here 2412 | TypeCacheEntry *typentry; | ^~~~~~~~ Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com