Skip to content

PostgreSQL RDS 14.17 changes

0

I'm encountering an issue when attempting to run the Postgres Pre-Setup Script when creating a new database

The error I'm seeing is:

ERROR: must be owner of type numeric SQL state: 42501

This occurs when executing the following statements: ALTER TYPE numeric OWNER TO current_user; ALTER TYPE bool OWNER TO current_user; ALTER TYPE varchar OWNER TO current_user; ALTER TYPE int2 OWNER TO current_user; ALTER TYPE int4 OWNER TO current_user; ALTER TYPE int8 OWNER TO current_user; ALTER TYPE timestamp OWNER TO current_user; ALTER TYPE date OWNER TO current_user;

I’m logged in as the RDS mastruser running it again on the new database (PostgreSQL RDS 14.17), This issue is now affecting our new database setups and dmp restorations in our environments.

This previously worked when we were on PostgreSQL RDS 14.12

I am able to execute the following in our on-prem environments with no issues. I wanted to see why i am all the sudden seeing these errors with the current version and not the previous versions

2 Answers
0

The error you're encountering is related to permissions in Amazon RDS for PostgreSQL 14.17. In RDS environments, even the master user has certain restrictions that aren't present in on-premises PostgreSQL installations.

The master user in Amazon RDS for PostgreSQL is granted the DBA role, but certain privileges are restricted as part of AWS's managed service approach. Specifically, you don't have the permissions to alter the ownership of system objects like built-in data types (numeric, bool, varchar, etc.).

This restriction is part of AWS's security model for RDS, where certain system-level operations are reserved for the AWS-managed users. Even though you're using the master user account, you cannot change ownership of system types.

For your database setup and restoration processes, you'll need to modify your scripts to remove these ALTER TYPE OWNER statements, as they're not necessary for most application functionality and aren't permitted in the RDS environment.

If you need to perform specific operations that require elevated privileges, you might want to look into using the rds_superuser role, which provides additional capabilities beyond the standard master user permissions. However, even with rds_superuser, there will still be limitations compared to a full superuser in an on-premises PostgreSQL installation.
Sources
Step 3: Create Your Target Aurora PostgreSQL Database - Database Migration Guide
Step 3: Create Your Target Amazon RDS for PostgreSQL Database - Database Migration Guide
Amazon RDS for Oracle RDSADMIN question | AWS re:Post

answered a year ago

AWS
SUPPORT ENGINEER

reviewed a year ago

0

Hi,

If I execute this SQL in version 14.17, I get the response that the type is owned by rdsadmin.

SELECT typowner::regrole 
  FROM pg_type t 
 WHERE typname = 'numeric';

query result

The mastr user is not same as rdsadmin and rdsadmin can't be granted to other role in RDS.

AWS

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Relevant content