From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Move pg_attrdef manipulation code into new file catalog/pg_attrd
Date: Mon, 21 Mar 2022 18:56:09 +0000
Message-ID: <E1nWNCK-000ku8-T5@gemulon.postgresql.org> (raw)
Move pg_attrdef manipulation code into new file catalog/pg_attrdef.c.
This is a pure refactoring commit: there isn't (I hope) any functional
change.
StoreAttrDefault and RemoveAttrDefault[ById] are moved from heap.c,
reducing the size of that overly-large file by about 300 lines.
I took the opportunity to trim unused #includes from heap.c, too.
Two new functions for translating between a pg_attrdef OID and the
relid/attnum of the owning column are created by extracting ad-hoc
code from objectaddress.c. This already removes one copy of said
code, and a follow-on bug fix will create more callers.
The only other function directly manipulating pg_attrdef is
AttrDefaultFetch. I judged it was better to leave that in relcache.c,
since it shares special concerns about recursion and error handling
with the rest of that module.
Discussion: https://postgr.es/m/651168.1647451676@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/17f3bc09284e1b529cdf524bbba709af6493f30c
Modified Files
--------------
src/backend/catalog/Makefile | 1 +
src/backend/catalog/heap.c | 330 ---------------------------
src/backend/catalog/objectaddress.c | 95 +-------
src/backend/catalog/pg_attrdef.c | 428 ++++++++++++++++++++++++++++++++++++
src/backend/commands/tablecmds.c | 1 +
src/include/catalog/heap.h | 8 +-
src/include/catalog/pg_attrdef.h | 13 ++
7 files changed, 450 insertions(+), 426 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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Move pg_attrdef manipulation code into new file catalog/pg_attrd
In-Reply-To: <E1nWNCK-000ku8-T5@gemulon.postgresql.org>
References: <E1nWNCK-000ku8-T5@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