public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: Andres Freund <[email protected]>
Cc: [email protected]
Cc: Amit Kapila <[email protected]>
Cc: Michael Paquier <[email protected]>
Subject: Re: pgstat include expansion
Date: Mon, 16 Feb 2026 17:18:36 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 2026-Feb-13, Andres Freund wrote:

> commit 7e638d7f509
> Author: Álvaro Herrera <[email protected]>
> Date:   2025-09-25 14:45:08 +0200
>  
>     Don't include execnodes.h in replication/conflict.h
> 
> added an include of access/transam.h, which I don't love being included,
> although it's less bad than some of the other cases. It's not actually to
> blame for that though, as it shrank what was included noticeably.


> diff --git a/src/include/pgstat.h b/src/include/pgstat.h
> index fff7ecc2533..a2021a0e66f 100644
> --- a/src/include/pgstat.h
> +++ b/src/include/pgstat.h
> @@ -11,18 +11,20 @@
>  #ifndef PGSTAT_H
>  #define PGSTAT_H
>  
> -#include "access/transam.h"		/* for FullTransactionId */
>  #include "datatype/timestamp.h"
>  #include "portability/instr_time.h"
>  #include "postmaster/pgarch.h"	/* for MAX_XFN_CHARS */
> -#include "replication/conflict.h"
> -#include "replication/worker_internal.h"
> +#include "replication/conflict.h"	/* for CONFLICT_NUM_TYPES */
>  #include "utils/backend_progress.h" /* for backward compatibility */	/* IWYU pragma: export */
>  #include "utils/backend_status.h"	/* for backward compatibility */	/* IWYU pragma: export */
>  #include "utils/pgstat_kind.h"
> -#include "utils/relcache.h"
>  #include "utils/wait_event.h"	/* for backward compatibility */	/* IWYU pragma: export */
>  
> +/* to avoid including access/transam.h, for FullTransactionId */
> +typedef struct FullTransactionId FullTransactionId;
> +
> +/* to avoid including utils/relcache.h */
> +typedef struct RelationData *Relation;
>  
>  /* ----------
>   * Paths for the statistics files (relative to installation's $PGDATA).

Yeah, I intended not to add access/transam.h here and instead
forward-declare FullTransactionId, but forgot to actually remove it
before pushing.  So +1 for what you're doing here with that.  Same with
relcache.h and most of the other changes you're doing here.

I don't think the removal of pg_list.h works terribly well though, as
that is something that I would expect to be pretty much everywhere, so
it seems somewhat pointless to try to avoid it in this file.

I'm not very sure what to do about LogicalRepWorkerType ... will
follow-up to Amit's reply.

I think we should in addition remove some includes that were kept during
recent IWYU hacking "for backwards compatibility", and instead include
them explicitly wherever they are needed.  The attached does that.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"You're _really_ hosed if the person doing the hiring doesn't understand
relational systems: you end up with a whole raft of programmers, none of
whom has had a Date with the clue stick."              (Andrew Sullivan)
https://postgr.es/m/[email protected]






view thread (3+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: pgstat include expansion
  In-Reply-To: <[email protected]>

* 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