MCPcopy Create free account
hub / github.com/apache/cloudberry / AlterTypeNamespace_oid

Function AlterTypeNamespace_oid

src/backend/commands/typecmds.c:4039–4060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4037}
4038
4039Oid
4040AlterTypeNamespace_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.

Callers 2

AlterObjectNamespace_oidFunction · 0.85
AlterTypeNamespaceFunction · 0.85

Calls 10

pg_type_ownercheckFunction · 0.85
GetUserIdFunction · 0.85
aclcheck_error_typeFunction · 0.85
get_element_typeFunction · 0.85
get_array_typeFunction · 0.85
format_type_beFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50
errhintFunction · 0.50

Tested by

no test coverage detected