| 4037 | } |
| 4038 | |
| 4039 | Oid |
| 4040 | AlterTypeNamespace_oid(Oid typeOid, Oid nspOid, ObjectAddresses *objsMoved) |
| 4041 | { |
| 4042 | Oid elemOid; |
| 4043 | |
| 4044 | /* check permissions on type */ |
| 4045 | if (!pg_type_ownercheck(typeOid, GetUserId())) |
| 4046 | aclcheck_error_type(ACLCHECK_NOT_OWNER, typeOid); |
| 4047 | |
| 4048 | /* don't allow direct alteration of array types */ |
| 4049 | elemOid = get_element_type(typeOid); |
| 4050 | if (OidIsValid(elemOid) && get_array_type(elemOid) == typeOid) |
| 4051 | ereport(ERROR, |
| 4052 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
| 4053 | errmsg("cannot alter array type %s", |
| 4054 | format_type_be(typeOid)), |
| 4055 | errhint("You can alter type %s, which will alter the array type as well.", |
| 4056 | format_type_be(elemOid)))); |
| 4057 | |
| 4058 | /* and do the work */ |
| 4059 | return AlterTypeNamespaceInternal(typeOid, nspOid, false, true, objsMoved); |
| 4060 | } |
| 4061 | |
| 4062 | /* |
| 4063 | * Move specified type to new namespace. |
no test coverage detected