|
32 | 32 | #include "catalog/pg_opclass.h" |
33 | 33 | #include "catalog/pg_opfamily.h" |
34 | 34 | #include "catalog/pg_proc.h" |
| 35 | +#include "catalog/pg_subscription.h" |
35 | 36 | #include "catalog/pg_ts_config.h" |
36 | 37 | #include "catalog/pg_ts_dict.h" |
37 | 38 | #include "catalog/pg_ts_parser.h" |
@@ -90,6 +91,12 @@ report_name_conflict(Oid classId, const char *name) |
90 | 91 | case LanguageRelationId: |
91 | 92 | msgfmt = gettext_noop("language \"%s\" already exists"); |
92 | 93 | break; |
| 94 | + case PublicationRelationId: |
| 95 | + msgfmt = gettext_noop("publication \"%s\" already exists"); |
| 96 | + break; |
| 97 | + case SubscriptionRelationId: |
| 98 | + msgfmt = gettext_noop("subscription \"%s\" already exists"); |
| 99 | + break; |
93 | 100 | default: |
94 | 101 | elog(ERROR, "unsupported object class %u", classId); |
95 | 102 | break; |
@@ -256,6 +263,12 @@ AlterObjectRename_internal(Relation rel, Oid objectId, const char *new_name) |
256 | 263 | IsThereOpFamilyInNamespace(new_name, opf->opfmethod, |
257 | 264 | opf->opfnamespace); |
258 | 265 | } |
| 266 | + else if (classId == SubscriptionRelationId) |
| 267 | + { |
| 268 | + if (SearchSysCacheExists2(SUBSCRIPTIONNAME, MyDatabaseId, |
| 269 | + CStringGetDatum(new_name))) |
| 270 | + report_name_conflict(classId, new_name); |
| 271 | + } |
259 | 272 | else if (nameCacheId >= 0) |
260 | 273 | { |
261 | 274 | if (OidIsValid(namespaceId)) |
@@ -364,6 +377,8 @@ ExecRenameStmt(RenameStmt *stmt) |
364 | 377 | case OBJECT_TSDICTIONARY: |
365 | 378 | case OBJECT_TSPARSER: |
366 | 379 | case OBJECT_TSTEMPLATE: |
| 380 | + case OBJECT_PUBLICATION: |
| 381 | + case OBJECT_SUBSCRIPTION: |
367 | 382 | { |
368 | 383 | ObjectAddress address; |
369 | 384 | Relation catalog; |
|
0 commit comments