Re: split tablecmds.c - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: split tablecmds.c
Date
Msg-id aS4aGQp3WXzFoCVz@nathan
Whole thread Raw
In response to Re: split tablecmds.c  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: split tablecmds.c
Re: split tablecmds.c
List pgsql-hackers
On Mon, Dec 01, 2025 at 01:59:01PM -0500, Tom Lane wrote:
> I didn't do any math about it, but that's got to be a far faster rate
> of expansion than the overall PG code base.  Maybe partitioning is
> largely to blame?  Perhaps analyzing what functionality got added
> here in the past dozen or so years would yield some ideas for how to
> split it.
> 
> +1 for a split, if we can figure out a good plan.

I tried to move the partitioning-related code to a new file, and it wasn't
too bad.  Note that there are a couple of internal-to-tablecmds.c things
that need to be exported.  Besides that, the attached patch is still pretty
rough, and I'm not sure I correctly placed the line in the sand when
determining what stays and what goes, but this at least shows the general
shape of what's needed.  (BTW git was generating an atrocious diff for
tablecmds.c.  You might need to set the diff algorithm to "minimal" if you
are similarly affected.) 

 src/backend/commands/Makefile         |    1 +
 src/backend/commands/meson.build      |    1 +
 src/backend/commands/partcmds.c       | 3377
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/backend/commands/tablecmds.c      | 3456
+--------------------------------------------------------------------------------------------
 src/backend/partitioning/partbounds.c |    1 +
 src/include/commands/partcmds.h       |   53 ++
 src/include/commands/tablecmds.h      |  134 +++-
 7 files changed, 3575 insertions(+), 3448 deletions(-)

-- 
nathan

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: freespace buffer locking
Next
From: Myles Lewis
Date:
Subject: Re: [PATCH] Add native PIVOT syntax for SQL Server/Oracle compatibility