I'm using gcloud sql exporter for postgres and Im having problems to restore the dump locally on docker. I saw that there is a GRANT to superuser role for example that does not exist. Im assuming the command is better used to restore the db on GC. Is there any way to clean the dump file while executing the command or I have to clean in another process ?
Also I can connect and can see that the tables are there, but there is no data.
Hi @lferreira,
Welcome to Google Cloud Community!
It looks like you're running into permission issues because the dump has a GRANT statement for a superuser role that doesn't exist in your local Docker setup. To address this, you may need to clean the dump before restoring it by generating the dump directly using the pg_dump
utility with flags such as --no-owner
, --no-acl
, --clean
, and --if-exists
. These flags help remove permission issues and generate a dump file that is cleaner and more compatible when restoring a Cloud SQL database to a local Docker environment.
Regarding your issue with missing data but existing tables, this might be due to incomplete or incorrect export options. Ensure you're exporting both schema and data, and check for any errors during the export process. For restoring locally, ensure you use the correct PostgreSQL restore command, such as pg_restore
(for custom/directory formats) or psql (for plain SQL dumps), depending on the dump format.
You can also check best practices for importing and exporting data, which could be useful in your case.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.