moving some code out of explain.c

Robert Haas <robertmhaas@gmail.com>

From: Robert Haas <robertmhaas@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-02-18T18:04:03Z
Lists: pgsql-hackers

Attachments

While contemplating some additions to explain.c, I noticed that this
file has become rather large -- 5924 lines on master. I'm generally
not a fan of very large source files, and I think it would be a good
idea to start splitting this one up before things get completely out
of control. Here are a few patches to move some chunks of code to
separate files (explain_format.c and explain_dr.c).

I think in cases like this there is a tendency to want to achieve an
even split of the original file, but in practice I think that tends
not to be difficult to achieve. These two patches combined move about
1000 lines of code into separate files, which I think is actually
quite a good result for a refactoring of this sort. We might want to
split it up even more, but I don't feel like that has to be done in
the first set of patches or that all such patches have to come from
me. So I propose to do just this much for now.

Comments?

-- 
Robert Haas
EDB: http://www.enterprisedb.com

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.