An Azure managed PostgreSQL database service for app development and deployment.
Please follow the scenario
-- Step 1: Create test roles
CREATE ROLE adminuser LOGIN PASSWORD 'pass';
CREATE ROLE fabric_user LOGIN PASSWORD 'pass';
-- Step 2: Create a separate schema owner
CREATE ROLE schema_owner LOGIN PASSWORD 'pass';
CREATE SCHEMA test_schema AUTHORIZATION schema_owner;
-- Step 3: Create a table in that schema
SET ROLE adminuser;
CREATE TABLE test_schema.test_table (id int);
-- Step 4: Attempt ownership change
ALTER TABLE test_schema.test_table OWNER TO fabric_user;
If the role performing the ownership change does not have the required permissions on the schema, PostgreSQL may return an error similar to:
ERROR: permission denied for schema test_schema
To validate this, connect as the schema owner and grant the necessary schema privileges:
SET ROLE schema_owner;
GRANT USAGE ON SCHEMA test_schema TO adminuser;
GRANT CREATE ON SCHEMA test_schema TO adminuser;
Then retry the ownership change.
Hope this helps, Please let us know if you have any questions or concerns.