Re: moving some code out of explain.c

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Álvaro Herrera <alvherre@alvh.no-ip.org>, Peter Geoghegan <pg@bowt.ie>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andrew Dunstan <andrew@dunslane.net>
Date: 2025-02-27T20:05:54Z
Lists: pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> The thing that was bugging me a bit is that explain_format.h includes
> explain.h.

Yeah, I did not like that at all either -- it makes things a bit
circular, and I fear IWYU is going to make stupid recommendations
like not including explain.h in explain.c.

Did you look at avoiding that with our standard trick of writing
detail-free struct declarations?  That is, explain_format.h
would need

struct ExplainState;		/* avoid including explain.h here */

and then s/ExplainState/struct ExplainState/ in all the function
declarations.  You'd still need to get List from someplace, but
it could be gotten by including primnodes.h or even pg_list.h.

			regards, tom lane



Commits

  1. Avoid including explain.h in explain_format.h and explain_dr.h

  2. Create explain_dr.c and move DestReceiver-related code there.

  3. Create explain_format.c and move relevant code there.