PostgreSQL is a popular open-source relational database used by enterprise developers and startups, enabling rapid prototyping and supporting mission-critical applications. Amazon RDS for PostgreSQL and Amazon Aurora PostgreSQL-Compatible Edition facilitate easy setup, operation, and scaling of PostgreSQL deployments in the AWS Cloud, automating administrative tasks like software installation, storage management, and backups.
The pglogical extension, compatible with PostgreSQL versions 9.4 and higher, allows for asynchronous replication and is supported on RDS for PostgreSQL and Aurora PostgreSQL from version 12. It uses a publisher/subscriber model for logical streaming replication.
To migrate a PostgreSQL database from Google Cloud SQL to RDS for PostgreSQL or Aurora PostgreSQL, users must configure the primary database in Cloud SQL, create a PostgreSQL user with replication privileges, enable logical replication parameters, and create the pglogical extension. The RDS instance also requires a special user for replication, enabling logical replication parameters and creating the pglogical extension.
Known limitations of pglogical include the inability to replicate primary key changes directly, the need to manually transfer extensions, and the lack of support for materialized views and large objects. Workarounds involve using surrogate keys for primary keys, manually creating extensions, and converting large objects to bytea columns or storing them in Amazon S3. DDL statements are not automatically replicated, but can be queued using the pglogical.replicate_ddl_command function.