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 1vvfLY-00Cpcl-0G for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 17:40:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvfLW-00EewL-1H for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 17:40:18 +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 1vvfLV-00Eew9-2j for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 17:40:18 +0000 Received: from fout-a8-smtp.messagingengine.com ([103.168.172.151]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vvfLR-00000001Qmq-3pOl for pgsql-hackers@postgresql.org; Thu, 26 Feb 2026 17:40:17 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id 9506BEC0AC3; Thu, 26 Feb 2026 12:40:11 -0500 (EST) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-04.internal (MEProxy); Thu, 26 Feb 2026 12:40:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1772127611; x= 1772214011; bh=901OFzYBzxxBpCFKK2rgJF7LDAnifoIHKmU+hOux5ic=; b=V sErUafxzqfMK3/vL6hDaUdda6NmnQ6paYN+eVbUcglOSrZ+Eooq3RzMyBfJ9dFGT YHHqQtyKa9QSg0fkcs0E4jEBtTrrkMJ731EJkL+c8OjXUa35PWPQ7tFf7G9bu+79 cHgQXnWYaiw0BcjgKvSsYQtT/C/FG99CmvWgJaY/99xJy574JqYR2sAwQxygQ8tF Wf33NkPZcFaL13/dRbgYt3aRaO7DaLFYhvvC1YEiOiS9wT2k+8hHirS8veTiALt7 G6T4eZRDTE/fj54LqsXFMju7lqSWV/3eUFg/kOqhzUYtmsZxcm6Scpj78WB2Glvo OpnvTiTQ+YfXDtZCNxADw== 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 :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1772127611; x=1772214011; bh=9 01OFzYBzxxBpCFKK2rgJF7LDAnifoIHKmU+hOux5ic=; b=CucVHxHiLeXaGw+RB YwOWJi+Lz3mOQZWkg0EEWpdk2DQ1Hs2f1XUjjDaAGr9OJzzx0ou3uHXZKZT7sKuH ik/DKxu7nlWlgH+jmhVzXYD89tSLZj+Z47Ws5aZ+qBtkXEZkR0s/VaxUdf531cZO /fs4q1A/1O6LVVxUIZpq3DNOJb8Go/oAYXzHshWOR1IgEL7X+RzwsQUTlNQqU632 GsNauKautiQNGT4ShQQPvmjzqivubZLIVB3U3S2NteMB5HYSR+b7oThHfsq8z44V pihHz3IUbJvT84bGq2lVmrzrzUiVR8trJlX+cjxcyN39yH98HoHXKx+gWw1SmOIz NDxYQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvgeeiieeiucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesmhekreertddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeetkedujedutedtiefgteejgedtffefueetffegfffhgffgleelhfff jedtheefvdenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgv sehkuhhrihhlvghmuhdruggvpdhnsggprhgtphhtthhopeehpdhmohguvgepshhmthhpoh huthdprhgtphhtthhopegrnhgurhgvshesrghnrghrrgiivghlrdguvgdprhgtphhtthho pegrmhhithdrkhgrphhilhgrudeisehgmhgrihhlrdgtohhmpdhrtghpthhtohephhhlih hnnhgrkhgrsehikhhirdhfihdprhgtphhtthhopehmihgthhgrvghlsehprghquhhivghr rdighiiipdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqh hlrdhorhhg X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 26 Feb 2026 12:40:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1772127608; bh=tnirJ4n+7zn4LMyBK1AB1VjJQdaaauclVBOMr/vS8s0=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=xuiPpKxSDiWJG9Ew3Kn2Nr8nMRw+KHQirb0wX8bHSc0E6agBbIZnnk1RjBPFwQUtH HCnY503QGVyrb90ARRIHNcejPQlgUQXtgJfQooovoY8AJs0YARh8qKKLOKukSmI0yK PILTI7MUyQykfJXjfjbNs27VIMW3QsTK7BDHL8QIIRoMDp7y/QFDaeCo1Do5SIJ5Ga frsYpaeZnzBL1sCgu6HHDUG02R87k6e5JPOtDISYO2/DUP6jcqGOrE3Jbig65ZJtyJ lhrwjTLRuBPIutzASAznpIw+ICzIJ4pLFzCLCo8qQntOukbMNNc2RMo2MRlPr+NQlB E0sw9RYuKaeyg== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 85D8E7A; Thu, 26 Feb 2026 18:40:08 +0100 (CET) Date: Thu, 26 Feb 2026 18:40:08 +0100 From: Alvaro Herrera To: Andres Freund Cc: Heikki Linnakangas , pgsql-hackers@postgresql.org, Amit Kapila , Michael Paquier Subject: Re: pgstat include expansion Message-ID: <202602261733.s2rkxezwuif6@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wxuasfobqau5ms4q" 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 --wxuasfobqau5ms4q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2026-Feb-26, Andres Freund wrote: > I'm not sure that including in latch.h really would an improvement though - > that's included in proc.h and libpq.h, which both are fairly widely included > [1]. Although we cannot remove latch.h, what we can do is remove proc.h from shm_mq.h, which is actually very good because the proliferation of stuff from there is enormous. See the attached. Practically all the network of dependents of proc.h comes from there. The fallout is even somewhat insane. I think this is a good cleanup. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Industry suffers from the managerial dogma that for the sake of stability and continuity, the company should be independent of the competence of individual employees." (E. Dijkstra) --wxuasfobqau5ms4q Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Avoid-including-proc.h-in-shm_mq.h.patch" From ba3dec8480aae835e458fdc35fff67e13dfb611e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Herrera?= Date: Thu, 26 Feb 2026 18:29:49 +0100 Subject: [PATCH] Avoid including proc.h in shm_mq.h This prevents proliferation of proc.h to tons of other places. --- src/backend/access/brin/brin.c | 1 + src/backend/access/gin/gininsert.c | 1 + src/backend/access/heap/heapam.c | 1 + src/backend/access/heap/vacuumlazy.c | 1 + src/backend/access/nbtree/nbtsort.c | 1 + src/backend/access/transam/parallel.c | 1 + src/backend/catalog/namespace.c | 1 + src/backend/commands/async.c | 1 + src/backend/commands/vacuumparallel.c | 1 + src/backend/executor/execParallel.c | 1 + src/backend/executor/nodeAppend.c | 1 + src/backend/executor/nodeGather.c | 1 + src/backend/libpq/pqmq.c | 1 + src/backend/optimizer/plan/createplan.c | 1 + src/backend/replication/logical/applyparallelworker.c | 2 ++ src/backend/replication/logical/tablesync.c | 1 + src/backend/replication/logical/worker.c | 1 + src/backend/storage/ipc/procsignal.c | 1 + src/backend/storage/ipc/shm_mq.c | 1 + src/backend/utils/activity/backend_progress.c | 1 + src/backend/utils/misc/guc_tables.c | 1 + src/include/access/parallel.h | 2 ++ src/include/libpq/pqmq.h | 1 + src/include/storage/shm_mq.h | 4 +++- src/test/modules/test_shm_mq/setup.c | 1 + src/test/modules/test_shm_mq/test.c | 1 + src/test/modules/test_shm_mq/worker.c | 2 ++ 27 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index 6887e421442..9cd563fd0c3 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -33,6 +33,7 @@ #include "postmaster/autovacuum.h" #include "storage/bufmgr.h" #include "storage/freespace.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/acl.h" #include "utils/datum.h" diff --git a/src/backend/access/gin/gininsert.c b/src/backend/access/gin/gininsert.c index 0d63fb4ba27..ee9b6106922 100644 --- a/src/backend/access/gin/gininsert.c +++ b/src/backend/access/gin/gininsert.c @@ -27,6 +27,7 @@ #include "nodes/execnodes.h" #include "pgstat.h" #include "storage/bufmgr.h" +#include "storage/proc.h" #include "storage/predicate.h" #include "tcop/tcopprot.h" #include "utils/datum.h" diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 98d53caeea8..d534258e547 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -47,6 +47,7 @@ #include "port/pg_bitutils.h" #include "storage/lmgr.h" #include "storage/predicate.h" +#include "storage/proc.h" #include "storage/procarray.h" #include "utils/datum.h" #include "utils/injection_point.h" diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 4be267ff657..1f11d8c1567 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -149,6 +149,7 @@ #include "postmaster/autovacuum.h" #include "storage/bufmgr.h" #include "storage/freespace.h" +#include "storage/latch.h" #include "storage/lmgr.h" #include "storage/read_stream.h" #include "utils/lsyscache.h" diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 3a45508f62e..fd9d4087b5a 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -52,6 +52,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "storage/bulk_write.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/rel.h" #include "utils/sortsupport.h" diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index 44786dc131f..e69c4b74248 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -36,6 +36,7 @@ #include "pgstat.h" #include "storage/ipc.h" #include "storage/predicate.h" +#include "storage/proc.h" #include "storage/spin.h" #include "tcop/tcopprot.h" #include "utils/combocid.h" diff --git a/src/backend/catalog/namespace.c b/src/backend/catalog/namespace.c index 4b0f4ba115d..56b87d878e8 100644 --- a/src/backend/catalog/namespace.c +++ b/src/backend/catalog/namespace.c @@ -48,6 +48,7 @@ #include "nodes/makefuncs.h" #include "storage/ipc.h" #include "storage/lmgr.h" +#include "storage/proc.h" #include "storage/procarray.h" #include "utils/acl.h" #include "utils/builtins.h" diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 657c591618d..0b6d119dad0 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -176,6 +176,7 @@ #include "miscadmin.h" #include "storage/dsm_registry.h" #include "storage/ipc.h" +#include "storage/latch.h" #include "storage/lmgr.h" #include "storage/procsignal.h" #include "tcop/tcopprot.h" diff --git a/src/backend/commands/vacuumparallel.c b/src/backend/commands/vacuumparallel.c index c3b3c9ea21a..279108ca89f 100644 --- a/src/backend/commands/vacuumparallel.c +++ b/src/backend/commands/vacuumparallel.c @@ -35,6 +35,7 @@ #include "optimizer/paths.h" #include "pgstat.h" #include "storage/bufmgr.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/lsyscache.h" #include "utils/rel.h" diff --git a/src/backend/executor/execParallel.c b/src/backend/executor/execParallel.c index f87978c137e..ac84af294c9 100644 --- a/src/backend/executor/execParallel.c +++ b/src/backend/executor/execParallel.c @@ -45,6 +45,7 @@ #include "jit/jit.h" #include "nodes/nodeFuncs.h" #include "pgstat.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/datum.h" #include "utils/dsa.h" diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c index 7138dc692c6..39d9442c121 100644 --- a/src/backend/executor/nodeAppend.c +++ b/src/backend/executor/nodeAppend.c @@ -64,6 +64,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "storage/latch.h" +#include "storage/lwlock.h" /* Shared state for parallel-aware Append. */ struct ParallelAppendState diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c index 4105f1d1968..114693abb32 100644 --- a/src/backend/executor/nodeGather.c +++ b/src/backend/executor/nodeGather.c @@ -36,6 +36,7 @@ #include "executor/tqueue.h" #include "miscadmin.h" #include "optimizer/optimizer.h" +#include "storage/latch.h" #include "utils/wait_event.h" diff --git a/src/backend/libpq/pqmq.c b/src/backend/libpq/pqmq.c index 6e4bbfb5aa1..7e4a725b796 100644 --- a/src/backend/libpq/pqmq.c +++ b/src/backend/libpq/pqmq.c @@ -20,6 +20,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "replication/logicalworker.h" +#include "storage/latch.h" #include "tcop/tcopprot.h" #include "utils/builtins.h" diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 21f1988cf22..50b0e10308b 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -17,6 +17,7 @@ #include "postgres.h" #include "access/sysattr.h" +#include "access/transam.h" #include "catalog/pg_class.h" #include "foreign/fdwapi.h" #include "miscadmin.h" diff --git a/src/backend/replication/logical/applyparallelworker.c b/src/backend/replication/logical/applyparallelworker.c index 1730ace5490..7cd6e912a9c 100644 --- a/src/backend/replication/logical/applyparallelworker.c +++ b/src/backend/replication/logical/applyparallelworker.c @@ -166,7 +166,9 @@ #include "replication/origin.h" #include "replication/worker_internal.h" #include "storage/ipc.h" +#include "storage/latch.h" #include "storage/lmgr.h" +#include "storage/proc.h" #include "tcop/tcopprot.h" #include "utils/inval.h" #include "utils/memutils.h" diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c index 2f2f0121ecf..bccbf61bf39 100644 --- a/src/backend/replication/logical/tablesync.c +++ b/src/backend/replication/logical/tablesync.c @@ -112,6 +112,7 @@ #include "replication/walreceiver.h" #include "replication/worker_internal.h" #include "storage/ipc.h" +#include "storage/latch.h" #include "storage/lmgr.h" #include "utils/acl.h" #include "utils/array.h" diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index bae8c011390..f9c4b484754 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -281,6 +281,7 @@ #include "rewrite/rewriteHandler.h" #include "storage/buffile.h" #include "storage/ipc.h" +#include "storage/latch.h" #include "storage/lmgr.h" #include "storage/procarray.h" #include "tcop/tcopprot.h" diff --git a/src/backend/storage/ipc/procsignal.c b/src/backend/storage/ipc/procsignal.c index 7505c9d3a37..d47d180a32f 100644 --- a/src/backend/storage/ipc/procsignal.c +++ b/src/backend/storage/ipc/procsignal.c @@ -28,6 +28,7 @@ #include "storage/condition_variable.h" #include "storage/ipc.h" #include "storage/latch.h" +#include "storage/proc.h" #include "storage/shmem.h" #include "storage/sinval.h" #include "storage/smgr.h" diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c index 3ce6068ac54..7e9fbc00705 100644 --- a/src/backend/storage/ipc/shm_mq.c +++ b/src/backend/storage/ipc/shm_mq.c @@ -22,6 +22,7 @@ #include "pgstat.h" #include "port/pg_bitutils.h" #include "postmaster/bgworker.h" +#include "storage/proc.h" #include "storage/shm_mq.h" #include "storage/spin.h" #include "utils/memutils.h" diff --git a/src/backend/utils/activity/backend_progress.c b/src/backend/utils/activity/backend_progress.c index 5addb2d004f..b0359771de5 100644 --- a/src/backend/utils/activity/backend_progress.c +++ b/src/backend/utils/activity/backend_progress.c @@ -12,6 +12,7 @@ #include "access/parallel.h" #include "libpq/pqformat.h" +#include "storage/proc.h" #include "utils/backend_progress.h" #include "utils/backend_status.h" diff --git a/src/backend/utils/misc/guc_tables.c b/src/backend/utils/misc/guc_tables.c index 741fce8dede..38aaf82f120 100644 --- a/src/backend/utils/misc/guc_tables.c +++ b/src/backend/utils/misc/guc_tables.c @@ -85,6 +85,7 @@ #include "storage/large_object.h" #include "storage/pg_shmem.h" #include "storage/predicate.h" +#include "storage/proc.h" #include "storage/procnumber.h" #include "storage/standby.h" #include "tcop/backend_startup.h" diff --git a/src/include/access/parallel.h b/src/include/access/parallel.h index 01bdf2bec1f..60f857675e0 100644 --- a/src/include/access/parallel.h +++ b/src/include/access/parallel.h @@ -14,6 +14,8 @@ #ifndef PARALLEL_H #define PARALLEL_H +#include + #include "access/xlogdefs.h" #include "lib/ilist.h" #include "postmaster/bgworker.h" diff --git a/src/include/libpq/pqmq.h b/src/include/libpq/pqmq.h index c62fffb5998..36780c0816e 100644 --- a/src/include/libpq/pqmq.h +++ b/src/include/libpq/pqmq.h @@ -14,6 +14,7 @@ #define PQMQ_H #include "lib/stringinfo.h" +#include "storage/procnumber.h" #include "storage/shm_mq.h" extern void pq_redirect_to_shm_mq(dsm_segment *seg, shm_mq_handle *mqh); diff --git a/src/include/storage/shm_mq.h b/src/include/storage/shm_mq.h index aa5676f6a12..6f78f4a3acb 100644 --- a/src/include/storage/shm_mq.h +++ b/src/include/storage/shm_mq.h @@ -15,7 +15,9 @@ #include "postmaster/bgworker.h" #include "storage/dsm.h" -#include "storage/proc.h" + +/* avoid including storage/proc.h */ +typedef struct PGPROC PGPROC; /* The queue itself, in shared memory. */ struct shm_mq; diff --git a/src/test/modules/test_shm_mq/setup.c b/src/test/modules/test_shm_mq/setup.c index 579e5933d28..36bb255922c 100644 --- a/src/test/modules/test_shm_mq/setup.c +++ b/src/test/modules/test_shm_mq/setup.c @@ -18,6 +18,7 @@ #include "miscadmin.h" #include "pgstat.h" #include "postmaster/bgworker.h" +#include "storage/proc.h" #include "storage/shm_toc.h" #include "test_shm_mq.h" #include "utils/memutils.h" diff --git a/src/test/modules/test_shm_mq/test.c b/src/test/modules/test_shm_mq/test.c index fe1794c6077..ce97e6e1aa4 100644 --- a/src/test/modules/test_shm_mq/test.c +++ b/src/test/modules/test_shm_mq/test.c @@ -16,6 +16,7 @@ #include "fmgr.h" #include "miscadmin.h" #include "pgstat.h" +#include "storage/proc.h" #include "varatt.h" #include "test_shm_mq.h" diff --git a/src/test/modules/test_shm_mq/worker.c b/src/test/modules/test_shm_mq/worker.c index 6a4147554bb..e13c05ae5c7 100644 --- a/src/test/modules/test_shm_mq/worker.c +++ b/src/test/modules/test_shm_mq/worker.c @@ -21,6 +21,8 @@ #include "miscadmin.h" #include "storage/ipc.h" +#include "storage/latch.h" +#include "storage/proc.h" #include "storage/procarray.h" #include "storage/shm_mq.h" #include "storage/shm_toc.h" -- 2.47.3 --wxuasfobqau5ms4q--