Re: Avoid circular header file dependency

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Avoid circular header file dependency
Date: 2025-04-27 15:46:10
Message-ID: 350192.1745768770@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> writes:
> On Sat, Apr 26, 2025 at 02:55:51PM -0400, Tom Lane wrote:
>> I think the actual problem is that plpython.h
>> does this:
>>
>> /*
>> * Used throughout, so it's easier to just include it everywhere.
>> */
>> #include "plpy_util.h"

> Agree.

>> which is exactly the sort of cowboy modularity violation that hurts
>> when you have to clean it up. Taking that out requires having to
>> manually include plpy_util.h in all the relevant .c files, but on
>> the other hand we can remove their vestigial direct inclusions of
>> plpython.h.

> Yeah, makes sense. I checked the s/plpython.h/plpy_util.h/ replacements and
> the includes alphabetical ordering is still preserved. Also misc-header-include-cycle
> is now happy so LGTM.

Pushed, thanks for reviewing. I'll leave the wait_event.h issue
to Michael.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ilia Evdokimov 2025-04-27 19:58:52 Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment
Previous Message Alexander Lakhin 2025-04-27 14:00:01 Re: optimize file transfer in pg_upgrade