From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove circular #include's between plpython.h and plpy_util.h.
Date: Sun, 27 Apr 2025 15:43:10 +0000
Message-ID: <E1u949t-0023IV-3C@gemulon.postgresql.org> (raw)
Remove circular #include's between plpython.h and plpy_util.h.
plpython.h included plpy_util.h, simply on the grounds that "it's
easier to just include it everywhere". However, plpy_util.h must
include plpython.h, or it won't pass headerscheck. While the
resulting circularity doesn't have any immediate bad effect,
it's poor design. We have seen serious messes arise in the past
from overly-broad inclusion footprints created by such circularities,
so let's establish a project policy against it.
To fix, just replace *.c files' inclusions of plpython.h with
plpy_util.h. They'll pull in plpython.h indirectly; indeed, almost
all have already done so via inclusions of other plpy_xxx.h headers.
(Any extensions using plpython.h can do likewise without breaking
the compatibility of their code with prior Postgres versions.)
Reported-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aAxQ6fcY5QQV1lo3@ip-10-97-1-34.eu-west-3.compute.internal
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/2311f193ea7db23f68f5471ae2c35940fc0d4794
Modified Files
--------------
contrib/hstore_plpython/hstore_plpython.c | 2 +-
contrib/jsonb_plpython/jsonb_plpython.c | 2 +-
contrib/ltree_plpython/ltree_plpython.c | 2 +-
src/pl/plpython/plpy_cursorobject.c | 2 +-
src/pl/plpython/plpy_elog.c | 2 +-
src/pl/plpython/plpy_exec.c | 2 +-
src/pl/plpython/plpy_main.c | 2 +-
src/pl/plpython/plpy_planobject.c | 2 +-
src/pl/plpython/plpy_plpymodule.c | 2 +-
src/pl/plpython/plpy_procedure.c | 2 +-
src/pl/plpython/plpy_resultobject.c | 2 +-
src/pl/plpython/plpy_spi.c | 2 +-
src/pl/plpython/plpy_subxactobject.c | 2 +-
src/pl/plpython/plpy_typeio.c | 2 +-
src/pl/plpython/plpy_util.c | 1 -
src/pl/plpython/plpython.h | 9 ++++-----
16 files changed, 18 insertions(+), 20 deletions(-)
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: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Remove circular #include's between plpython.h and plpy_util.h.
In-Reply-To: <E1u949t-0023IV-3C@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox