pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove ObjectClass type
Date: Tue, 26 Mar 2024 09:16:50 +0000
Message-ID: <E1rp2vJ-005jmJ-Kt@gemulon.postgresql.org> (raw)

Remove ObjectClass type

ObjectClass is an enum whose values correspond to catalog OIDs.  But
the extra layer of redirection, which is used only in small parts of
the code, and the similarity to ObjectType, are confusing and
cumbersome.

One advantage has been that some switches processing the OCLASS enum
don't have "default:" cases.  This is so that the compiler tells us
when we fail to add support for some new object class.  But you can
also handle that with some assertions and proper test coverage.  It's
not even clear how strong this benefit is.  For example, in
AlterObjectNamespace_oid(), you could still put a new OCLASS into the
"ignore object types that don't have schema-qualified names" case, and
it might or might not be wrong.  Also, there are already various
OCLASS switches that do have a default case, so it's not even clear
what the preferred coding style should be.

Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQT3caUbcCcszNewCCmMbCuyP7XNAm60J3ybd6PN5kH2Dw%40mai...

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/89e5ef7e21812916c9cf9fcf56e45f0f74034656

Modified Files
--------------
src/backend/catalog/dependency.c     | 239 +++++---------------------
src/backend/catalog/objectaddress.c  | 316 +++++++++++++++--------------------
src/backend/commands/alter.c         |  73 ++------
src/backend/commands/event_trigger.c | 130 +++-----------
src/backend/commands/tablecmds.c     |  62 ++-----
src/include/catalog/dependency.h     |  51 ------
src/include/commands/event_trigger.h |   2 +-
src/tools/pgindent/typedefs.list     |   1 -
8 files changed, 233 insertions(+), 641 deletions(-)



Message-ID: <E1rp2vJ-005jmJ-Kt@gemulon.postgresql.org>
Permalink:  ../E1rp2vJ-005jmJ-Kt@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rp2vJ-005jmJ-Kt@gemulon.postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Remove ObjectClass type
  In-Reply-To: <E1rp2vJ-005jmJ-Kt@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