|
50 | 50 | * Executes an ALTER OBJECT / RENAME TO statement. Based on the object
|
51 | 51 | * type, the function appropriate to that type is executed.
|
52 | 52 | */
|
53 |
| -void |
| 53 | +Oid |
54 | 54 | ExecRenameStmt(RenameStmt *stmt)
|
55 | 55 | {
|
56 | 56 | switch (stmt->renameType)
|
57 | 57 | {
|
58 | 58 | case OBJECT_AGGREGATE:
|
59 |
| - RenameAggregate(stmt->object, stmt->objarg, stmt->newname); |
60 |
| - break; |
| 59 | + return RenameAggregate(stmt->object, stmt->objarg, stmt->newname); |
61 | 60 |
|
62 | 61 | case OBJECT_COLLATION:
|
63 |
| - RenameCollation(stmt->object, stmt->newname); |
64 |
| - break; |
| 62 | + return RenameCollation(stmt->object, stmt->newname); |
65 | 63 |
|
66 | 64 | case OBJECT_CONSTRAINT:
|
67 |
| - RenameConstraint(stmt); |
68 |
| - break; |
| 65 | + return RenameConstraint(stmt); |
69 | 66 |
|
70 | 67 | case OBJECT_CONVERSION:
|
71 |
| - RenameConversion(stmt->object, stmt->newname); |
72 |
| - break; |
| 68 | + return RenameConversion(stmt->object, stmt->newname); |
73 | 69 |
|
74 | 70 | case OBJECT_DATABASE:
|
75 |
| - RenameDatabase(stmt->subname, stmt->newname); |
76 |
| - break; |
| 71 | + return RenameDatabase(stmt->subname, stmt->newname); |
77 | 72 |
|
78 | 73 | case OBJECT_FDW:
|
79 |
| - RenameForeignDataWrapper(stmt->subname, stmt->newname); |
80 |
| - break; |
| 74 | + return RenameForeignDataWrapper(stmt->subname, stmt->newname); |
81 | 75 |
|
82 | 76 | case OBJECT_FOREIGN_SERVER:
|
83 |
| - RenameForeignServer(stmt->subname, stmt->newname); |
84 |
| - break; |
| 77 | + return RenameForeignServer(stmt->subname, stmt->newname); |
85 | 78 |
|
86 | 79 | case OBJECT_EVENT_TRIGGER:
|
87 |
| - RenameEventTrigger(stmt->subname, stmt->newname); |
88 |
| - break; |
| 80 | + return RenameEventTrigger(stmt->subname, stmt->newname); |
89 | 81 |
|
90 | 82 | case OBJECT_FUNCTION:
|
91 |
| - RenameFunction(stmt->object, stmt->objarg, stmt->newname); |
92 |
| - break; |
| 83 | + return RenameFunction(stmt->object, stmt->objarg, stmt->newname); |
93 | 84 |
|
94 | 85 | case OBJECT_LANGUAGE:
|
95 |
| - RenameLanguage(stmt->subname, stmt->newname); |
96 |
| - break; |
| 86 | + return RenameLanguage(stmt->subname, stmt->newname); |
97 | 87 |
|
98 | 88 | case OBJECT_OPCLASS:
|
99 |
| - RenameOpClass(stmt->object, stmt->subname, stmt->newname); |
100 |
| - break; |
| 89 | + return RenameOpClass(stmt->object, stmt->subname, stmt->newname); |
101 | 90 |
|
102 | 91 | case OBJECT_OPFAMILY:
|
103 |
| - RenameOpFamily(stmt->object, stmt->subname, stmt->newname); |
104 |
| - break; |
| 92 | + return RenameOpFamily(stmt->object, stmt->subname, stmt->newname); |
105 | 93 |
|
106 | 94 | case OBJECT_ROLE:
|
107 |
| - RenameRole(stmt->subname, stmt->newname); |
108 |
| - break; |
| 95 | + return RenameRole(stmt->subname, stmt->newname); |
109 | 96 |
|
110 | 97 | case OBJECT_SCHEMA:
|
111 |
| - RenameSchema(stmt->subname, stmt->newname); |
112 |
| - break; |
| 98 | + return RenameSchema(stmt->subname, stmt->newname); |
113 | 99 |
|
114 | 100 | case OBJECT_TABLESPACE:
|
115 |
| - RenameTableSpace(stmt->subname, stmt->newname); |
116 |
| - break; |
| 101 | + return RenameTableSpace(stmt->subname, stmt->newname); |
117 | 102 |
|
118 | 103 | case OBJECT_TABLE:
|
119 | 104 | case OBJECT_SEQUENCE:
|
120 | 105 | case OBJECT_VIEW:
|
121 | 106 | case OBJECT_INDEX:
|
122 | 107 | case OBJECT_FOREIGN_TABLE:
|
123 |
| - RenameRelation(stmt); |
124 |
| - break; |
| 108 | + return RenameRelation(stmt); |
125 | 109 |
|
126 | 110 | case OBJECT_COLUMN:
|
127 | 111 | case OBJECT_ATTRIBUTE:
|
128 |
| - renameatt(stmt); |
129 |
| - break; |
| 112 | + return renameatt(stmt); |
130 | 113 |
|
131 | 114 | case OBJECT_TRIGGER:
|
132 |
| - renametrig(stmt); |
133 |
| - break; |
| 115 | + return renametrig(stmt); |
134 | 116 |
|
135 | 117 | case OBJECT_TSPARSER:
|
136 |
| - RenameTSParser(stmt->object, stmt->newname); |
137 |
| - break; |
| 118 | + return RenameTSParser(stmt->object, stmt->newname); |
138 | 119 |
|
139 | 120 | case OBJECT_TSDICTIONARY:
|
140 |
| - RenameTSDictionary(stmt->object, stmt->newname); |
141 |
| - break; |
| 121 | + return RenameTSDictionary(stmt->object, stmt->newname); |
142 | 122 |
|
143 | 123 | case OBJECT_TSTEMPLATE:
|
144 |
| - RenameTSTemplate(stmt->object, stmt->newname); |
145 |
| - break; |
| 124 | + return RenameTSTemplate(stmt->object, stmt->newname); |
146 | 125 |
|
147 | 126 | case OBJECT_TSCONFIGURATION:
|
148 |
| - RenameTSConfiguration(stmt->object, stmt->newname); |
149 |
| - break; |
| 127 | + return RenameTSConfiguration(stmt->object, stmt->newname); |
150 | 128 |
|
151 | 129 | case OBJECT_DOMAIN:
|
152 | 130 | case OBJECT_TYPE:
|
153 |
| - RenameType(stmt); |
154 |
| - break; |
| 131 | + return RenameType(stmt); |
155 | 132 |
|
156 | 133 | default:
|
157 | 134 | elog(ERROR, "unrecognized rename stmt type: %d",
|
158 | 135 | (int) stmt->renameType);
|
| 136 | + return InvalidOid; /* keep compiler happy */ |
159 | 137 | }
|
160 | 138 | }
|
161 | 139 |
|
162 | 140 | /*
|
163 | 141 | * Executes an ALTER OBJECT / SET SCHEMA statement. Based on the object
|
164 | 142 | * type, the function appropriate to that type is executed.
|
165 | 143 | */
|
166 |
| -void |
| 144 | +Oid |
167 | 145 | ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
|
168 | 146 | {
|
169 | 147 | switch (stmt->objectType)
|
170 | 148 | {
|
171 | 149 | case OBJECT_AGGREGATE:
|
172 |
| - AlterFunctionNamespace(stmt->object, stmt->objarg, true, |
173 |
| - stmt->newschema); |
174 |
| - break; |
| 150 | + return AlterFunctionNamespace(stmt->object, stmt->objarg, true, |
| 151 | + stmt->newschema); |
175 | 152 |
|
176 | 153 | case OBJECT_COLLATION:
|
177 |
| - AlterCollationNamespace(stmt->object, stmt->newschema); |
178 |
| - break; |
| 154 | + return AlterCollationNamespace(stmt->object, stmt->newschema); |
179 | 155 |
|
180 | 156 | case OBJECT_EXTENSION:
|
181 |
| - AlterExtensionNamespace(stmt->object, stmt->newschema); |
182 |
| - break; |
| 157 | + return AlterExtensionNamespace(stmt->object, stmt->newschema); |
183 | 158 |
|
184 | 159 | case OBJECT_FUNCTION:
|
185 |
| - AlterFunctionNamespace(stmt->object, stmt->objarg, false, |
186 |
| - stmt->newschema); |
187 |
| - break; |
| 160 | + return AlterFunctionNamespace(stmt->object, stmt->objarg, false, |
| 161 | + stmt->newschema); |
188 | 162 |
|
189 | 163 | case OBJECT_SEQUENCE:
|
190 | 164 | case OBJECT_TABLE:
|
191 | 165 | case OBJECT_VIEW:
|
192 | 166 | case OBJECT_FOREIGN_TABLE:
|
193 |
| - AlterTableNamespace(stmt); |
194 |
| - break; |
| 167 | + return AlterTableNamespace(stmt); |
195 | 168 |
|
196 | 169 | case OBJECT_TYPE:
|
197 | 170 | case OBJECT_DOMAIN:
|
198 |
| - AlterTypeNamespace(stmt->object, stmt->newschema, stmt->objectType); |
199 |
| - break; |
| 171 | + return AlterTypeNamespace(stmt->object, stmt->newschema, |
| 172 | + stmt->objectType); |
200 | 173 |
|
201 | 174 | /* generic code path */
|
202 | 175 | case OBJECT_CONVERSION:
|
@@ -228,12 +201,15 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
|
228 | 201 | AlterObjectNamespace_internal(catalog, address.objectId,
|
229 | 202 | nspOid);
|
230 | 203 | heap_close(catalog, RowExclusiveLock);
|
| 204 | + |
| 205 | + return address.objectId; |
231 | 206 | }
|
232 | 207 | break;
|
233 | 208 |
|
234 | 209 | default:
|
235 | 210 | elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d",
|
236 | 211 | (int) stmt->objectType);
|
| 212 | + return InvalidOid; /* keep compiler happy */ |
237 | 213 | }
|
238 | 214 | }
|
239 | 215 |
|
@@ -435,38 +411,35 @@ AlterObjectNamespace_internal(Relation rel, Oid objid, Oid nspOid)
|
435 | 411 | * Executes an ALTER OBJECT / OWNER TO statement. Based on the object
|
436 | 412 | * type, the function appropriate to that type is executed.
|
437 | 413 | */
|
438 |
| -void |
| 414 | +Oid |
439 | 415 | ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
|
440 | 416 | {
|
441 | 417 | Oid newowner = get_role_oid(stmt->newowner, false);
|
442 | 418 |
|
443 | 419 | switch (stmt->objectType)
|
444 | 420 | {
|
445 | 421 | case OBJECT_DATABASE:
|
446 |
| - AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner); |
447 |
| - break; |
| 422 | + return AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner); |
448 | 423 |
|
449 | 424 | case OBJECT_SCHEMA:
|
450 |
| - AlterSchemaOwner(strVal(linitial(stmt->object)), newowner); |
451 |
| - break; |
| 425 | + return AlterSchemaOwner(strVal(linitial(stmt->object)), newowner); |
452 | 426 |
|
453 | 427 | case OBJECT_TYPE:
|
454 | 428 | case OBJECT_DOMAIN: /* same as TYPE */
|
455 |
| - AlterTypeOwner(stmt->object, newowner, stmt->objectType); |
| 429 | + return AlterTypeOwner(stmt->object, newowner, stmt->objectType); |
456 | 430 | break;
|
457 | 431 |
|
458 | 432 | case OBJECT_FDW:
|
459 |
| - AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)), |
460 |
| - newowner); |
461 |
| - break; |
| 433 | + return AlterForeignDataWrapperOwner(strVal(linitial(stmt->object)), |
| 434 | + newowner); |
462 | 435 |
|
463 | 436 | case OBJECT_FOREIGN_SERVER:
|
464 |
| - AlterForeignServerOwner(strVal(linitial(stmt->object)), newowner); |
465 |
| - break; |
| 437 | + return AlterForeignServerOwner(strVal(linitial(stmt->object)), |
| 438 | + newowner); |
466 | 439 |
|
467 | 440 | case OBJECT_EVENT_TRIGGER:
|
468 |
| - AlterEventTriggerOwner(strVal(linitial(stmt->object)), newowner); |
469 |
| - break; |
| 441 | + return AlterEventTriggerOwner(strVal(linitial(stmt->object)), |
| 442 | + newowner); |
470 | 443 |
|
471 | 444 | /* Generic cases */
|
472 | 445 | case OBJECT_AGGREGATE:
|
@@ -508,12 +481,16 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
|
508 | 481 |
|
509 | 482 | AlterObjectOwner_internal(catalog, address.objectId, newowner);
|
510 | 483 | heap_close(catalog, RowExclusiveLock);
|
| 484 | + |
| 485 | + return address.objectId; |
511 | 486 | }
|
512 | 487 | break;
|
513 | 488 |
|
514 | 489 | default:
|
515 | 490 | elog(ERROR, "unrecognized AlterOwnerStmt type: %d",
|
516 | 491 | (int) stmt->objectType);
|
| 492 | + |
| 493 | + return InvalidOid; /* keep compiler happy */ |
517 | 494 | }
|
518 | 495 | }
|
519 | 496 |
|
|
0 commit comments