From b1114f5576622f1993e9c0ce2b75447fc1c420df Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 7 Aug 2009 15:27:56 +0000 Subject: [PATCH] Fix some omissions in the dependency-object-class support for SQL/MED objects. Main problem found by Muhammad Aqeel, some cosmetic additions by me. --- src/backend/catalog/dependency.c | 22 ++++++++++++++-------- src/backend/commands/tablecmds.c | 10 +++++++++- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c index 8181cae64a..f0d3f03e4a 100644 --- a/src/backend/catalog/dependency.c +++ b/src/backend/catalog/dependency.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.89 2009/06/11 14:48:54 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/catalog/dependency.c,v 1.90 2009/08/07 15:27:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -143,7 +143,10 @@ static const Oid object_classes[MAX_OCLASS] = { TSConfigRelationId, /* OCLASS_TSCONFIG */ AuthIdRelationId, /* OCLASS_ROLE */ DatabaseRelationId, /* OCLASS_DATABASE */ - TableSpaceRelationId /* OCLASS_TBLSPACE */ + TableSpaceRelationId, /* OCLASS_TBLSPACE */ + ForeignDataWrapperRelationId, /* OCLASS_FDW */ + ForeignServerRelationId, /* OCLASS_FOREIGN_SERVER */ + UserMappingRelationId /* OCLASS_USER_MAPPING */ }; @@ -1115,20 +1118,23 @@ doDeletion(const ObjectAddress *object) RemoveTSConfigurationById(object->objectId); break; - case OCLASS_USER_MAPPING: - RemoveUserMappingById(object->objectId); + /* + * OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE intentionally + * not handled here + */ + + case OCLASS_FDW: + RemoveForeignDataWrapperById(object->objectId); break; case OCLASS_FOREIGN_SERVER: RemoveForeignServerById(object->objectId); break; - case OCLASS_FDW: - RemoveForeignDataWrapperById(object->objectId); + case OCLASS_USER_MAPPING: + RemoveUserMappingById(object->objectId); break; - /* OCLASS_ROLE, OCLASS_DATABASE, OCLASS_TBLSPACE not handled */ - default: elog(ERROR, "unrecognized object class: %u", object->classId); diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 1f2d67bcb1..f51f1f8c48 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.295 2009/08/02 22:14:52 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.296 2009/08/07 15:27:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -6037,12 +6037,20 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, case OCLASS_OPERATOR: case OCLASS_OPCLASS: case OCLASS_OPFAMILY: + case OCLASS_AMOP: + case OCLASS_AMPROC: case OCLASS_TRIGGER: case OCLASS_SCHEMA: case OCLASS_TSPARSER: case OCLASS_TSDICT: case OCLASS_TSTEMPLATE: case OCLASS_TSCONFIG: + case OCLASS_ROLE: + case OCLASS_DATABASE: + case OCLASS_TBLSPACE: + case OCLASS_FDW: + case OCLASS_FOREIGN_SERVER: + case OCLASS_USER_MAPPING: /* * We don't expect any of these sorts of objects to depend on -- 2.40.0