Re: Improve readability by using designated initializers when possible
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: jian he <jian.universality@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>,
Alvaro Herrera <alvherre@alvh.no-ip.org>, Japin Li <japinli@hotmail.com>,
Jelte Fennema-Nio <postgres@jeltef.nl>, Jeff Davis <pgsql@j-davis.com>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
pgsql-hackers@lists.postgresql.org
Date: 2024-03-20T14:08:39Z
Lists: pgsql-hackers
On 18.03.24 11:01, jian he wrote: > 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) > > EventTriggerSupportsObject should return false for the following: > SharedSecLabelRelationId > SharedDescriptionRelationId > DbRoleSettingRelationId > SharedDependRelationId > > but I am not sure ReplicationOriginRelationId. EventTriggerSupportsObject() (currently named EventTriggerSupportsObjectClass()) is only used by the deletion code, and these additional classes are not supported there anyway. Also, if they happen to show up there for some reason, then EventTriggerSQLDropAddObject() would error out in getObjectIdentityParts() or getObjectTypeDescription(). So you wouldn't get an event trigger firing on a previously unsupported class by accident. So I think this is robust enough.
Commits
-
Remove ObjectClass type
- 89e5ef7e2181 17.0 landed
-
Simplify pg_enc2gettext_tbl[] with C99-designated initializer syntax
- 655dc310460c 17.0 landed
-
Use C99-designated initializer syntax for arrays related to encodings
- ada87a4d95fc 17.0 landed
-
Remove last NULL element in config_group_names[]
- 48920476b490 17.0 landed
-
Use C99-designated initializer syntax for more arrays
- afd8ef39094b 17.0 landed
-
Remove unnecessary array object_classes[] in dependency.c
- ef5e2e90859a 17.0 landed
-
Add trailing commas to enum definitions
- 611806cd726f 17.0 cited