All Products
Search
Document Center

ApsaraDB RDS:What do I do if the "must be owner of xxx" error message is displayed when I execute the CREATE CAST statement on my ApsaraDB RDS for PostgreSQL instance?

Last Updated:Feb 27, 2026

When you execute a CREATE CAST statement on an ApsaraDB RDS for PostgreSQL instance, the following error is returned:

ERROR: must be owner of type xxx or type xxx

For example, this error occurs with the following statement:

CREATE CAST(boolean AS smallint) WITH INOUT AS implicit;

Cause

Creating a cast requires ownership of at least one of the involved data types. Built-in types such as boolean and smallint are owned by the system, so a regular database account cannot create casts between them. To resolve this, transfer ownership of the relevant type to your current role before running CREATE CAST.

Important

Your RDS instance must meet the following requirements:

  • Major engine version: PostgreSQL 10 or later.

  • Minor engine version: 20210531 or later. For information about how to view and update the minor engine version, see Update the minor engine version.

Solution

The following steps use CREATE CAST(boolean AS smallint) as an example.

  1. Connect to the database with a privileged account. For more information, see Create an account.

  2. Change the owner of the data type to your current role:

       ALTER type bool owner TO <your role>;
  3. Run the CREATE CAST statement again:

       CREATE CAST(boolean AS smallint) WITH INOUT AS implicit;