Re: Improve readability by using designated initializers when possible

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Japin Li <japinli(at)hotmail(dot)com>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Improve readability by using designated initializers when possible
Date: 2024-03-18 12:58:19
Message-ID: CACJufxGjFdodVJ08ptGVy6+nA6eEVbFdEz9NZYnv2TuFGJ4ynA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 18, 2024 at 6:01 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>
> On Mon, Mar 18, 2024 at 3:09 PM Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
> >
> > On 14.03.24 01:26, Michael Paquier wrote:
> > > -EventTriggerSupportsObjectClass(ObjectClass objclass)
> > > +EventTriggerSupportsObject(const ObjectAddress *object)
> > >
> > > The shortcut introduced here is interesting, but it is inconsistent.
> > > HEAD treats OCLASS_SUBSCRIPTION as something supported by event
> > > triggers, but as pg_subscription is a shared catalog it would be
> > > discarded with your change. Subscriptions are marked as supported in
> > > the event trigger table:
> > > https://www.postgresql.org/docs/devel/event-trigger-matrix.html
> >
> > Ah, good catch. Subscriptions are a little special there. Here is a
> > new patch that keeps the switch/case arrangement in that function. That
> > also makes it easier to keep the two EventTriggerSupports... functions
> > aligned. Also added a note about subscriptions and a reference to the
> > documentation.
>
> select relname from pg_class where relisshared and relkind = 'r';
> relname
> -----------------------
> pg_authid
> pg_subscription
> pg_database
> pg_db_role_setting
> pg_tablespace
> pg_auth_members
> pg_shdepend
> pg_shdescription
> pg_replication_origin
> pg_shseclabel
> pg_parameter_acl
> (11 rows)
>

also in function doDeletion
we have:

/*
* These global object types are not supported here.
*/
case AuthIdRelationId:
case DatabaseRelationId:
case TableSpaceRelationId:
case SubscriptionRelationId:
case ParameterAclRelationId:
elog(ERROR, "global objects cannot be deleted by doDeletion");
break;

do we need to add other global objects?

in the end, it does not matter since we have:
default:
elog(ERROR, "unsupported object class: %u", object->classId);

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2024-03-18 13:09:04 Re: Possibility to disable `ALTER SYSTEM`
Previous Message Robert Haas 2024-03-18 12:57:34 Re: Possibility to disable `ALTER SYSTEM`