pgsql: Remove unnecessary array object_classes[] in dependency.c

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove unnecessary array object_classes[] in dependency.c
Date: 2024-02-27 06:18:38
Message-ID: E1reqnW-000yIG-3T@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove unnecessary array object_classes[] in dependency.c

object_classes[] provided unnecessary indirection between catalog OIDs
and the enum ObjectClass when calling add_object_address(). This array
has been originally introduced in 30ec31604d5 and was useful because not
all relation OIDs were compile-time constants back then, which has not
been the case for a long time now for all the elements of ObjectClass.

This commit removes object_classes[], switching to the catalog OIDs
when calling add_object_address(). This shaves some code while saving
in maintenance because it was necessary to maintain the enum ObjectClass
and the array in sync when adding new object types.

Reported-by: Jeff Davis
Author: Jelte Fennema-Nio
Reviewed-by: Jian He, Michael Paquier
Discussion: https://postgr.es/m/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ef5e2e90859a39efdd3a78e528c544b585295a78

Modified Files
--------------
src/backend/catalog/dependency.c | 181 ++++++++++++++-------------------------
src/include/catalog/dependency.h | 4 +-
2 files changed, 63 insertions(+), 122 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2024-02-27 08:37:15 pgsql: Rationalize and improve error messages for some jsonpath items
Previous Message David Rowley 2024-02-27 03:39:57 pgsql: Adjust memory allocation functions to allow sibling calls