Re: pgsql: Move SQL-callable code related to multixacts into its own file

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-committers@lists.postgresql.org
Date: 2025-08-20T08:11:05Z
Lists: pgsql-hackers
On Tue, Aug 19, 2025 at 12:31:14PM +0200, Alvaro Herrera wrote:
> Hmm, don't you find strange that dbcommands.h is still included there?
> I wondered about that and found out that we have get_database_name()
> declared there.  It sort-of makes sense, because it was originally done
> by scanning pg_database, but since commit cb98e6fb8fd4 introduced a
> syscache for it, we can have this routine in lsyscache.c/h instead,
> where it feels more at home.  It also seems more sensible to declare
> get_database_oid() in pg_database.h.  After these two changes, a lot of
> files can stop including dbcommands.h.  This seems a nice cleanup to me,
> and passes headerscheck.
>
>  33 files changed, 39 insertions(+), 56 deletions(-)

Indeed, that's a nice located cleanup.
--
Michael

Commits

  1. Avoid including commands/dbcommands.h in so many places

  2. Remove unneeded header declarations in multixact.c

  3. Move SQL-callable code related to multixacts into its own file

  4. Create a syscache for pg_database-indexed-by-oid, and make use of it