GRANT OWNERSHIP
Syntax
GRANT OWNERSHIP ON
( DATABASE database_name
| SCHEMA [database_name.]schema_name
| RELATION [[database_name.]schema_name.]relation_name
| STORE store_name
| SCHEMA_REGISTRY schema_registry_name
| QUERY query_id
| DESCRIPTOR_SOURCE descriptor_source_name
| FUNCTION_SOURCE function_source_name
| FUNCTION function_identifier
| ROLE role_name
)
TO roleName
Description
Transfer ownership or an object to a new Role.
Ownership can only be transferred if the current role is the owner or the object and has been granted the destination role.
Examples
demodb.public/<no-store># LIST DATABASES;
+---------+-------------+----------+-------------------------------+
| Name | Is Default | Owner | Created At |
+=========+=============+==========+===============================+
| demodb | true | sysadmin | 2023-09-10 19:41:23 +0000 UTC |
+---------+-------------+----------+-------------------------------+
demodb.public/<no-store># GRANT OWNERSHIP ON DATABASE demodb TO rol1;
+-----------------+----------+------------------------------------------+
| Type | Command | Summary |
+=================+==========+==========================================+
| ownership grant | ALTER | Ownership of "main_db" granted to role |
| | | "rol1" |
+-----------------+----------+------------------------------------------+
demodb.public/<no-store># USE ROLE securityadmin;
+-------+---------------+----------+----------------------------+
| Type | Name | Command | Summary |
+=======+===============+==========+============================+
| role | securityadmin | USE | using role "securityadmin" |
+-------+---------------+----------+----------------------------+
demodb.public/<no-store># LIST DATABASES;
+---------+-------------+----------+-------------------------------+
| Name | Is Default | Owner | Created At |
+=========+=============+==========+===============================+
| user_db | false | orgadmin | 2024-06-05 19:41:23 +0000 UTC |
+---------+-------------+----------+-------------------------------+
| demodb | true | rol1 | 2023-09-10 19:41:23 +0000 UTC |
+---------+-------------+----------+-------------------------------+
Last updated