I am trying to migrate bunch of databases from AWS RDS Postresql server to GCP Cloud SQL. Since both are postgresql engine, I thought it will be a simple solution to take pgdump from aws and do import in gcp. However I am surprised when import cloud sql failed with error complaining some roles are missing. Below are the steps which are tried
Dump of database in AWS RDS
pg_dump -h <connection_endpoint> -U root -f db_dump.sql <db_name>
Then I tried to import it in GCP Cloud sql with below command
instance-1:~$ PGPASSWORD=<passwprd> psql --host=<host_name> --port=5432 --username=postgres --dbname=<db_name> < db_dump.sql
SET
SET
SET
SET
SET
set_config
------------
(1 row)
SET
SET
SET
CREATE SCHEMA
ERROR: must be member of role "rdsadmin"
CREATE SCHEMA
ERROR: must be member of role "root"
CREATE SCHEMA
ERROR: must be member of role "root"
CREATE SCHEMA
ERROR: must be member of role "root"
CREATE SCHEMA
ERROR: must be member of role "root"
CREATE EXTENSION
ERROR: must be owner of extension plpgsql
CREATE EXTENSION
COMMENT
SET
SET
CREATE TABLE...
As you can see rdsadmin and root roles are missing. How to make sure that these missing roles are present in GCP Cloud sql with correct settings because even after creating roles with same name in cloud sql it doesn't succeed? Any solution please?