* Move all indexes for the specified relation to another namespace. * * Note: we assume adequate permission checking was done by the caller, * and that the caller has a suitable lock on the owning relation. */
| 20326 | * and that the caller has a suitable lock on the owning relation. |
| 20327 | */ |
| 20328 | static void |
| 20329 | AlterIndexNamespaces(Relation classRel, Relation rel, |
| 20330 | Oid oldNspOid, Oid newNspOid, ObjectAddresses *objsMoved) |
| 20331 | { |
| 20332 | List *indexList; |
| 20333 | ListCell *l; |
| 20334 | |
| 20335 | indexList = RelationGetIndexList(rel); |
| 20336 | |
| 20337 | foreach(l, indexList) |
| 20338 | { |
| 20339 | Oid indexOid = lfirst_oid(l); |
| 20340 | ObjectAddress thisobj; |
| 20341 | |
| 20342 | thisobj.classId = RelationRelationId; |
| 20343 | thisobj.objectId = indexOid; |
| 20344 | thisobj.objectSubId = 0; |
| 20345 | |
| 20346 | /* |
| 20347 | * Note: currently, the index will not have its own dependency on the |
| 20348 | * namespace, so we don't need to do changeDependencyFor(). There's no |
| 20349 | * row type in pg_type, either. |
| 20350 | * |
| 20351 | * XXX this objsMoved test may be pointless -- surely we have a single |
| 20352 | * dependency link from a relation to each index? |
| 20353 | */ |
| 20354 | if (!object_address_present(&thisobj, objsMoved)) |
| 20355 | { |
| 20356 | AlterRelationNamespaceInternal(classRel, indexOid, |
| 20357 | oldNspOid, newNspOid, |
| 20358 | false, objsMoved); |
| 20359 | add_exact_object_address(&thisobj, objsMoved); |
| 20360 | } |
| 20361 | } |
| 20362 | |
| 20363 | list_free(indexList); |
| 20364 | } |
| 20365 | |
| 20366 | /* |
| 20367 | * Move all identity and SERIAL-column sequences of the specified relation to another |
no test coverage detected