mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Update some more ObjectType switch statements to not have default
This allows the compiler to complain if a case has been missed. In these instances, the tradeoff of having to list a few unneeded cases to silence the compiler seems better than the risk of actually missing one. Discussion: https://www.postgresql.org/message-id/flat/fce5c98a-45da-19e7-dad0-21096bccd66e%40enterprisedb.com
This commit is contained in:
@ -481,10 +481,45 @@ does_not_exist_skipping(ObjectType objtype, Node *object)
|
||||
msg = gettext_noop("publication \"%s\" does not exist, skipping");
|
||||
name = strVal(object);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized object type: %d", (int) objtype);
|
||||
|
||||
case OBJECT_COLUMN:
|
||||
case OBJECT_DATABASE:
|
||||
case OBJECT_FOREIGN_TABLE:
|
||||
case OBJECT_INDEX:
|
||||
case OBJECT_MATVIEW:
|
||||
case OBJECT_ROLE:
|
||||
case OBJECT_SEQUENCE:
|
||||
case OBJECT_SUBSCRIPTION:
|
||||
case OBJECT_TABLE:
|
||||
case OBJECT_TABLESPACE:
|
||||
case OBJECT_VIEW:
|
||||
/*
|
||||
* These are handled elsewhere, so if someone gets here the code
|
||||
* is probably wrong or should be revisited.
|
||||
*/
|
||||
elog(ERROR, "unsupported object type: %d", (int) objtype);
|
||||
break;
|
||||
|
||||
case OBJECT_AMOP:
|
||||
case OBJECT_AMPROC:
|
||||
case OBJECT_ATTRIBUTE:
|
||||
case OBJECT_DEFAULT:
|
||||
case OBJECT_DEFACL:
|
||||
case OBJECT_DOMCONSTRAINT:
|
||||
case OBJECT_LARGEOBJECT:
|
||||
case OBJECT_PARAMETER_ACL:
|
||||
case OBJECT_PUBLICATION_NAMESPACE:
|
||||
case OBJECT_PUBLICATION_REL:
|
||||
case OBJECT_TABCONSTRAINT:
|
||||
case OBJECT_USER_MAPPING:
|
||||
/* These are currently not used or needed. */
|
||||
elog(ERROR, "unsupported object type: %d", (int) objtype);
|
||||
break;
|
||||
|
||||
/* no default, to let compiler warn about missing case */
|
||||
}
|
||||
if (!msg)
|
||||
elog(ERROR, "unrecognized object type: %d", (int) objtype);
|
||||
|
||||
if (!args)
|
||||
ereport(NOTICE, (errmsg(msg, name)));
|
||||
|
Reference in New Issue
Block a user