Re: [PATCH] Remove unused #include's in src/backend/commands/*

Aleksander Alekseev <aleksander@tigerdata.com>

From: Aleksander Alekseev <aleksander@tigerdata.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Álvaro Herrera <alvherre@kurilemu.de>, Andres Freund <andres@anarazel.de>, Nathan Bossart <nathandbossart@gmail.com>
Date: 2025-10-09T15:08:39Z
Lists: pgsql-hackers
Hi Álvaro,

> I wonder how many of these changes pass the compilation only because the
> header you're removing is indirectly being included via another header.
> In this particular case, it's because slot.h includes walreceiver.h
> which includes walsender.h, so this removal has no effect.

Hm.... on the flip side if the file is already included what's the
point in the second #include? It doesn't do anything and is redundant,
isn't it? At least my text editor highlights it as such (because
clangd tells it so). This is not a huge problem of course, just a bit
distracting.

If the idea is to always have an explicit list of all the includes (no
indirect ones) I think we may end up with pretty long lists, and I
don't instantly see value in this to be honest.

-- 
Best regards,
Aleksander Alekseev