Re: postgres.h included from relcache.h - but removing it breaks pg_upgrade - Mailing list pgsql-hackers

From Tom Lane
Subject Re: postgres.h included from relcache.h - but removing it breaks pg_upgrade
Date
Msg-id 550651.1631587219@sss.pgh.pa.us
Whole thread Raw
In response to postgres.h included from relcache.h - but removing it breaks pg_upgrade  (Andres Freund <andres@anarazel.de>)
Responses Re: postgres.h included from relcache.h - but removing it breaks pg_upgrade
Re: postgres.h included from relcache.h - but removing it breaks pg_upgrade
List pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> I noticed that postgres.h is included from relcache.h (starting in [1]) and
> wanted to fix that - it violates our usual policy against including postgres.h
> from within headers.

Ugh, yeah, that's entirely against policy.

As for the fix ... what in the world is pg_upgrade doing including
relcache.h?  It seems like there's a more fundamental problem here:
either relcache.h is declaring something that needs to be elsewhere,
or pg_upgrade is doing something it should not.

> I was also wondering if we should put something in c.h and postgres.h to avoid
> redundant includes?

No.  If anything, I'd want to throw an error for "redundant" includes
of these files, because it's a pretty good red flag about
poorly-thought-out header modularization.

            regards, tom lane



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Skipping logical replication transactions on subscriber side
Next
From: Andres Freund
Date:
Subject: Re: postgres.h included from relcache.h - but removing it breaks pg_upgrade