postgresqlmigrationgoogle-cloud-sql

Postgres CloudSQL Migration: ERROR: permission denied to set parameter "log_min_duration_statement"


I am trying to use the Database Migration Service to migrate an existing database into CloudSQL.

When I start the migration, I receive the following error:

finished setup replication with errors: [api_production]: error importing schema: failed to restore schema: stderr=pg_restore: while PROCESSING TOC: pg_restore: from TOC entry 3997; 0 0 DATABASE PROPERTIES api_production postgres pg_restore: error: could not execute query: ERROR: permission denied to set parameter "log_min_duration_statement" Command was: ALTER DATABASE api_production SET log_min_duration_statement TO '500ms'; pg_restore: warning: errors ignored on restore: 1 , stdout=

How can I continue the migration, ignoring the SET PARAMETER statement?


Solution

  • I have finally been able to start the migration by resetting the parameters on the source database (setting them to match was insufficient).

    This can be done from a postgres console on the source database:

    reset log_min_duration_statement;
    ALTER DATABASE <database_name> RESET log_min_duration_statement;
    ALTER DATABASE postgres RESET log_min_duration_statement;