Re: some more include removal from headers

From: Andres Freund <andres(at)anarazel(dot)de>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: some more include removal from headers
Date: 2026-04-02 16:27:12
Message-ID: olxypm44m2bqzicr7biie37swt7c5uevpq3sbf7pzcykd2mirw@nw5pydkpjgeg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-04-02 12:52:13 +0200, Álvaro Herrera wrote:
> Here's low-hanging fruit I noticed while eyeballing a patch in the
> commitfest. This removes pg_publication.h from utils/rel.h, which is
> really nice because pg_publication includes objectaddress.h which in
> turn includes parsenodes.h (an absolute disaster we have there, harder
> to cleanup; not in the mood). But this here is nice and well contained.

These days including rel.h (indirectly) including objectaddress.h is
quite the disaster, because objectaddress.h recently grew an include of
syscache.h, as I complain about in [1].

I got pretty annoyed this cycle with how much rebuilding a simple change to
bufmgr.h triggers (due to hacking on it a lot). I started to write a series
to improve that, but didn't get around to posting that yet due to encountering
the issue 771fe0948ca fixed while improving the situation.

During that I encountered the objectaddress.h include, as part of which I then
complained about the issue in [1].

After the attached patches, a change to bufmgr.h triggers rebuilding 213
files, before it was 323. Not perfect, but better.

Would be nice to get rid of the bufmgr.h includes in access/nbtree.h and such,
but it looks like that'd be a bit more work.

I included your catalog/publication.h in it, as my version had surprisingly
extensive bitrot...

Greetings,

Andres Freund

[1] https://postgr.es/m/vlcexdcimsmvu3aplt2yxpfndkgtuvjsrms2fdl46rbw3k2kug%40drspkoxlaije

Attachment Content-Type Size
v2-0001-wip-Don-t-include-read_stream.h-in-tableam.h.patch text/x-diff 2.4 KB
v2-0002-wip-Don-t-include-snapmgr.h-in-bufmgr.h.patch text/x-diff 6.2 KB
v2-0003-wip-Don-t-include-relcache.h-in-bufmgr.h.patch text/x-diff 771 bytes
v2-0004-Don-t-include-snapshot.h-in-tableam.h.patch text/x-diff 1.4 KB
v2-0005-Don-t-include-xlogreader.h-in-xlog.h.patch text/x-diff 1.2 KB
v2-0006-Don-t-include-catalog-publication.h-in-utils-rel..patch text/x-diff 5.1 KB
v2-0007-Don-t-include-tupdesc.h-in-relcache.h.patch text/x-diff 1.4 KB
v2-0008-Don-t-include-relcache.h-in-rel.h.patch text/x-diff 704 bytes
v2-0009-Don-t-include-read_stream.h-in-heapam.h.patch text/x-diff 2.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2026-04-02 16:27:21 Re: pg_get__*_ddl consolidation
Previous Message Nathan Bossart 2026-04-02 16:17:00 Re: vectorized CRC on ARM64